├── scripts ├── besu │ ├── config │ │ ├── orion1 │ │ │ ├── nodeKey.pub │ │ │ ├── nodeKey.priv │ │ │ └── orion.conf │ │ ├── orion2 │ │ │ ├── nodeKey.pub │ │ │ ├── nodeKey.priv │ │ │ └── orion.conf │ │ ├── orion3 │ │ │ ├── nodeKey.pub │ │ │ ├── nodeKey.priv │ │ │ └── orion.conf │ │ ├── validator2 │ │ │ └── keys │ │ │ │ ├── key.priv │ │ │ │ └── key.pub │ │ ├── validator3 │ │ │ └── keys │ │ │ │ ├── key.priv │ │ │ │ └── key.pub │ │ ├── validator1-bootnode │ │ │ └── keys │ │ │ │ ├── key.priv │ │ │ │ └── key.pub │ │ ├── log-config.xml │ │ └── genesis.json │ ├── orion.sh │ ├── Dockerfile │ ├── docker-compose.yml │ └── besu.sh ├── deps │ ├── config │ │ ├── kafka │ │ │ ├── zookeeper_jaas.conf │ │ │ └── broker_jaas.conf │ │ ├── hashicorp │ │ │ ├── Dockerfile │ │ │ ├── config.hcl │ │ │ ├── vault.sh │ │ │ └── init.sh │ │ └── redis │ │ │ └── redis.conf │ └── docker-compose.yml └── kafka │ └── initTopics.sh ├── truffle-config.js ├── src ├── consume │ ├── index.ts │ └── consume.ts ├── send-tx │ ├── index.ts │ └── send-tx.ts ├── deploy-contract │ ├── index.ts │ └── deploy.ts ├── send-private-tx │ ├── index.ts │ └── send-private-tx.ts ├── get-catalog │ ├── index.ts │ └── app.ts ├── create-faucet │ ├── index.ts │ └── app.ts ├── generate-account │ ├── index.ts │ └── app.ts ├── register-chain │ ├── index.ts │ └── app.ts └── register-contract │ ├── index.ts │ └── app.ts ├── static ├── get-catalog.png ├── npm-consume.png ├── npm-deploy.png ├── npm-run-up.png ├── npm-send-tx.png ├── post-chain.png ├── post-faucet.png ├── generate-jwt.png ├── get-contract.png ├── token-lookup.png ├── compile-contract.png ├── etherscan-deploy.png ├── generate-account.png ├── json-rpc-proxy.png ├── npm-run-up-besu.png ├── orchestrate-logo.png ├── etherscan-account.png ├── etherscan-send-tx.png ├── hashicorp-accounts.png ├── register-contract.png ├── npm-send-private-tx.png ├── generate-account-faucet.png └── metamask-credit-faucet.png ├── .prettierrc ├── CHANGELOG.md ├── .gitignore ├── tsconfig.json ├── .github └── pull_request_template.md ├── smart-contracts └── Counter.sol ├── CLA.md ├── tslint.json ├── .env.besu.example ├── .env.infura-rinkeby.example ├── GOVERNANCE.md ├── CODE-OF-CONDUCT.md ├── package.json ├── docker-compose.yml ├── community-membership.md ├── CONTRIBUTING.md ├── LICENSE └── README.md /scripts/besu/config/orion1/nodeKey.pub: -------------------------------------------------------------------------------- 1 | A1aVtMxLCUHmBVHXoZzzBgPbW/wj5axDpW9X8l91SGo= -------------------------------------------------------------------------------- /scripts/besu/config/orion2/nodeKey.pub: -------------------------------------------------------------------------------- 1 | Ko2bVqD+nNlNYL5EE7y3IdOnviftjiizpjRt+HTuFBs= -------------------------------------------------------------------------------- /scripts/besu/config/orion3/nodeKey.pub: -------------------------------------------------------------------------------- 1 | k2zXEin4Ip/qBGlRkJejnGWdP9cjkK+DAvKNW31L2C8= -------------------------------------------------------------------------------- /truffle-config.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | contracts_directory: './smart-contracts' 3 | } 4 | -------------------------------------------------------------------------------- /src/consume/index.ts: -------------------------------------------------------------------------------- 1 | import { consume } from './consume' 2 | 3 | consume().catch(console.error) 4 | -------------------------------------------------------------------------------- /scripts/besu/config/validator2/keys/key.priv: -------------------------------------------------------------------------------- 1 | 0x90bc4259e10c215ee781a674c1728b40fd8f373a5422f59d0f30e698e3b99aa7 -------------------------------------------------------------------------------- /scripts/besu/config/validator3/keys/key.priv: -------------------------------------------------------------------------------- 1 | 0xa24c2ff06b615eaeae8a351c7100b4f21e57df7fc2bf0ff5a634dbd3b55f9afe -------------------------------------------------------------------------------- /static/get-catalog.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Consensys/orchestrate-quick-start/HEAD/static/get-catalog.png -------------------------------------------------------------------------------- /static/npm-consume.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Consensys/orchestrate-quick-start/HEAD/static/npm-consume.png -------------------------------------------------------------------------------- /static/npm-deploy.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Consensys/orchestrate-quick-start/HEAD/static/npm-deploy.png -------------------------------------------------------------------------------- /static/npm-run-up.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Consensys/orchestrate-quick-start/HEAD/static/npm-run-up.png -------------------------------------------------------------------------------- /static/npm-send-tx.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Consensys/orchestrate-quick-start/HEAD/static/npm-send-tx.png -------------------------------------------------------------------------------- /static/post-chain.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Consensys/orchestrate-quick-start/HEAD/static/post-chain.png -------------------------------------------------------------------------------- /static/post-faucet.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Consensys/orchestrate-quick-start/HEAD/static/post-faucet.png -------------------------------------------------------------------------------- /static/generate-jwt.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Consensys/orchestrate-quick-start/HEAD/static/generate-jwt.png -------------------------------------------------------------------------------- /static/get-contract.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Consensys/orchestrate-quick-start/HEAD/static/get-contract.png -------------------------------------------------------------------------------- /static/token-lookup.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Consensys/orchestrate-quick-start/HEAD/static/token-lookup.png -------------------------------------------------------------------------------- /scripts/besu/config/orion1/nodeKey.priv: -------------------------------------------------------------------------------- 1 | {"data":{"bytes":"hBsuQsGJzx4QHmFmBkNoI7YGnTmaZP4P+wBOdu56ljk="},"type":"unlocked"} -------------------------------------------------------------------------------- /scripts/besu/config/orion2/nodeKey.priv: -------------------------------------------------------------------------------- 1 | {"data":{"bytes":"wjeHURxQJUqZvhjMv+lxoRlXYnX/mpm0Iu/ldBr32Qs="},"type":"unlocked"} -------------------------------------------------------------------------------- /scripts/besu/config/orion3/nodeKey.priv: -------------------------------------------------------------------------------- 1 | {"data":{"bytes":"QmBfzDOxF99iInkXAPBAZpQQfelvPmHqbcO8tNHYtJM="},"type":"unlocked"} -------------------------------------------------------------------------------- /scripts/besu/config/validator1-bootnode/keys/key.priv: -------------------------------------------------------------------------------- 1 | 0xfd5a230bc6b636cef22ed8ddee3810ae67dd8c6c8145b7b56749522459a38bc1 -------------------------------------------------------------------------------- /static/compile-contract.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Consensys/orchestrate-quick-start/HEAD/static/compile-contract.png -------------------------------------------------------------------------------- /static/etherscan-deploy.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Consensys/orchestrate-quick-start/HEAD/static/etherscan-deploy.png -------------------------------------------------------------------------------- /static/generate-account.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Consensys/orchestrate-quick-start/HEAD/static/generate-account.png -------------------------------------------------------------------------------- /static/json-rpc-proxy.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Consensys/orchestrate-quick-start/HEAD/static/json-rpc-proxy.png -------------------------------------------------------------------------------- /static/npm-run-up-besu.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Consensys/orchestrate-quick-start/HEAD/static/npm-run-up-besu.png -------------------------------------------------------------------------------- /static/orchestrate-logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Consensys/orchestrate-quick-start/HEAD/static/orchestrate-logo.png -------------------------------------------------------------------------------- /.prettierrc: -------------------------------------------------------------------------------- 1 | { 2 | "printWidth": 120, 3 | "trailingComma": "none", 4 | "singleQuote": true, 5 | "semi": false 6 | } 7 | -------------------------------------------------------------------------------- /static/etherscan-account.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Consensys/orchestrate-quick-start/HEAD/static/etherscan-account.png -------------------------------------------------------------------------------- /static/etherscan-send-tx.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Consensys/orchestrate-quick-start/HEAD/static/etherscan-send-tx.png -------------------------------------------------------------------------------- /static/hashicorp-accounts.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Consensys/orchestrate-quick-start/HEAD/static/hashicorp-accounts.png -------------------------------------------------------------------------------- /static/register-contract.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Consensys/orchestrate-quick-start/HEAD/static/register-contract.png -------------------------------------------------------------------------------- /static/npm-send-private-tx.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Consensys/orchestrate-quick-start/HEAD/static/npm-send-private-tx.png -------------------------------------------------------------------------------- /static/generate-account-faucet.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Consensys/orchestrate-quick-start/HEAD/static/generate-account-faucet.png -------------------------------------------------------------------------------- /static/metamask-credit-faucet.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Consensys/orchestrate-quick-start/HEAD/static/metamask-credit-faucet.png -------------------------------------------------------------------------------- /scripts/besu/orion.sh: -------------------------------------------------------------------------------- 1 | 2 | #!/bin/bash 3 | 4 | cmd="/opt/orion/bin/orion /config/${ORION_NAME}/orion.conf" 5 | 6 | echo ${cmd} 7 | 8 | eval $cmd -------------------------------------------------------------------------------- /src/send-tx/index.ts: -------------------------------------------------------------------------------- 1 | import { sendTx } from './send-tx' 2 | 3 | sendTx() 4 | .then(() => { 5 | process.exit() 6 | }) 7 | .catch(console.error) 8 | -------------------------------------------------------------------------------- /src/deploy-contract/index.ts: -------------------------------------------------------------------------------- 1 | import { deploy } from './deploy' 2 | 3 | deploy() 4 | .then(() => { 5 | process.exit() 6 | }) 7 | .catch(console.error) 8 | -------------------------------------------------------------------------------- /scripts/besu/config/validator2/keys/key.pub: -------------------------------------------------------------------------------- 1 | 0x3548c87b9920ff16aa4bdcf01c85f25117a29ae1574d759bad48cc9463d8e9f7c3c1d1e9fb0d28e73898951f90e02714abb770fd6d22e90371882a45658800e9 -------------------------------------------------------------------------------- /scripts/besu/config/validator3/keys/key.pub: -------------------------------------------------------------------------------- 1 | 0xdcb9390953aec5dde1d60dd556c36827053ca9adaefd1b03f531592fea43824bae2919743f620bb8a9b6c2b9a54439771d4f9a74d261b74af7a10c2dd9f13c97 -------------------------------------------------------------------------------- /src/send-private-tx/index.ts: -------------------------------------------------------------------------------- 1 | import { sendTx } from './send-private-tx' 2 | 3 | sendTx() 4 | .then(() => { 5 | process.exit() 6 | }) 7 | .catch(console.error) 8 | -------------------------------------------------------------------------------- /scripts/besu/config/validator1-bootnode/keys/key.pub: -------------------------------------------------------------------------------- 1 | 0x05e2aab6df08db103fd75c4fb2b8582fe43eebce6a0f077b590a5e7f44ed081e498fa2c57788372d7bc0c41a34394f34c5c11332f4473a1bdf83589316edc2c4 -------------------------------------------------------------------------------- /CHANGELOG.md: -------------------------------------------------------------------------------- 1 | # CHANGELOG 2 | 3 | All notable changes to this project will be documented in this file. 4 | 5 | ## 2.0.0 (DATE) 6 | 7 | Quick start compatible with version 2.0+ of Orchestrate 8 | -------------------------------------------------------------------------------- /scripts/deps/config/kafka/zookeeper_jaas.conf: -------------------------------------------------------------------------------- 1 | Server { 2 | org.apache.zookeeper.server.auth.DigestLoginModule required 3 | user_super="adminsecret" 4 | user_kafka="kafkasecret"; 5 | }; 6 | -------------------------------------------------------------------------------- /src/get-catalog/index.ts: -------------------------------------------------------------------------------- 1 | // tslint:disable: no-console 2 | 3 | import { start } from './app' 4 | 5 | start() 6 | .then(() => { 7 | process.exit() 8 | }) 9 | .catch(console.log) 10 | -------------------------------------------------------------------------------- /scripts/deps/config/hashicorp/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM alpine:3.10 2 | 3 | RUN apk add jq curl 4 | 5 | # RUN mkdir /scripts 6 | 7 | # WORKDIR /scripts 8 | 9 | # COPY ./init.sh . 10 | 11 | # CMD ./init.sh -------------------------------------------------------------------------------- /src/create-faucet/index.ts: -------------------------------------------------------------------------------- 1 | // tslint:disable: no-console 2 | 3 | import { start } from './app' 4 | 5 | start() 6 | .then(() => { 7 | process.exit() 8 | }) 9 | .catch(console.log) 10 | -------------------------------------------------------------------------------- /src/generate-account/index.ts: -------------------------------------------------------------------------------- 1 | // tslint:disable: no-console 2 | 3 | import { start } from './app' 4 | 5 | start() 6 | .then(() => { 7 | process.exit() 8 | }) 9 | .catch(console.log) 10 | -------------------------------------------------------------------------------- /src/register-chain/index.ts: -------------------------------------------------------------------------------- 1 | // tslint:disable: no-console 2 | 3 | import { start } from './app' 4 | 5 | start() 6 | .then(() => { 7 | process.exit() 8 | }) 9 | .catch(console.log) 10 | -------------------------------------------------------------------------------- /src/register-contract/index.ts: -------------------------------------------------------------------------------- 1 | // tslint:disable: no-console 2 | 3 | import { start } from './app' 4 | 5 | start() 6 | .then(() => { 7 | process.exit() 8 | }) 9 | .catch(console.log) 10 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # IDE & OS specific 2 | .DS_Store 3 | .idea 4 | 5 | # Logs 6 | logs 7 | *.log 8 | 9 | # Dependencies 10 | node_modules 11 | yarn.lock 12 | 13 | # Contracts build 14 | build 15 | 16 | # Compiled JS 17 | dist 18 | 19 | # Env variable 20 | .env -------------------------------------------------------------------------------- /scripts/deps/config/hashicorp/config.hcl: -------------------------------------------------------------------------------- 1 | backend "file" { 2 | path = "/vault/file" 3 | } 4 | 5 | listener "tcp" { 6 | address = "vault:8200" 7 | tls_disable = true 8 | } 9 | 10 | default_lease_ttl = "168h", 11 | max_lease_ttl = "720h" 12 | 13 | log_level = "Info" 14 | -------------------------------------------------------------------------------- /scripts/deps/config/hashicorp/vault.sh: -------------------------------------------------------------------------------- 1 | # Retrieve token for authentication on vault 2 | token=$(docker run --rm -v deps_vault-token:/token alpine:latest more /token/.vault-token) 3 | 4 | # Run command 5 | docker-compose -f scripts/deps/docker-compose.yml exec -e VAULT_TOKEN="${token}" -e VAULT_ADDR="http://vault:8200" vault vault "$@" -------------------------------------------------------------------------------- /scripts/besu/config/orion1/orion.conf: -------------------------------------------------------------------------------- 1 | nodeurl = "http://orion1:8080/" 2 | nodeport = 8080 3 | nodenetworkinterface = "orion1" 4 | clienturl = "http://orion1:8888/" 5 | clientport = 8888 6 | clientnetworkinterface = "orion1" 7 | publickeys = ["/config/orion1/nodeKey.pub"] 8 | privatekeys = ["/config/orion1/nodeKey.priv"] 9 | tls = "off" 10 | -------------------------------------------------------------------------------- /scripts/besu/config/orion2/orion.conf: -------------------------------------------------------------------------------- 1 | nodeurl = "http://orion2:8080/" 2 | nodeport = 8080 3 | nodenetworkinterface = "orion2" 4 | clienturl = "http://orion2:8888/" 5 | clientport = 8888 6 | clientnetworkinterface = "orion2" 7 | othernodes = ["http://orion1:8080/"] 8 | publickeys = ["/config/orion2/nodeKey.pub"] 9 | privatekeys = ["/config/orion2/nodeKey.priv"] 10 | tls = "off" 11 | -------------------------------------------------------------------------------- /scripts/besu/config/orion3/orion.conf: -------------------------------------------------------------------------------- 1 | nodeurl = "http://orion3:8080/" 2 | nodeport = 8080 3 | nodenetworkinterface = "orion3" 4 | clienturl = "http://orion3:8888/" 5 | clientport = 8888 6 | clientnetworkinterface = "orion3" 7 | othernodes = ["http://orion1:8080/"] 8 | publickeys = ["/config/orion3/nodeKey.pub"] 9 | privatekeys = ["/config/orion3/nodeKey.priv"] 10 | tls = "off" 11 | -------------------------------------------------------------------------------- /tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "target": "es6", 4 | "module": "commonjs", 5 | "declaration": true, 6 | "outDir": "./dist", 7 | "strict": true, 8 | "resolveJsonModule": true, 9 | "allowSyntheticDefaultImports": true, 10 | "allowJs": true 11 | }, 12 | "include": ["src"], 13 | "exclude": ["node_modules", "**/*.test.ts"] 14 | } 15 | -------------------------------------------------------------------------------- /scripts/deps/config/kafka/broker_jaas.conf: -------------------------------------------------------------------------------- 1 | KafkaServer { 2 | org.apache.kafka.common.security.plain.PlainLoginModule required 3 | username="admin" 4 | password="admin-secret" 5 | user_admin="admin-secret" 6 | user_worker="worker-secret"; 7 | }; 8 | 9 | Client { 10 | org.apache.zookeeper.server.auth.DigestLoginModule required 11 | username="kafka" 12 | password="kafkasecret"; 13 | }; 14 | -------------------------------------------------------------------------------- /.github/pull_request_template.md: -------------------------------------------------------------------------------- 1 | 2 | 3 | ## PR Description 4 | 5 | ## Fixed Issue(s) 6 | 7 | 8 | 9 | 10 | ## Documentation 11 | 12 | - [ ] I thought about documentation and added the `documentation` label to this PR if updates are required. 13 | -------------------------------------------------------------------------------- /smart-contracts/Counter.sol: -------------------------------------------------------------------------------- 1 | pragma solidity ^0.5.0; 2 | 3 | /** 4 | * @dev Counter contract for demo purposes 5 | * 6 | */ 7 | contract Counter { 8 | uint256 counter; 9 | 10 | event Incremented(address from, uint256 by); 11 | 12 | /** 13 | * @dev increment counter of `value` 14 | */ 15 | function increment(uint256 value) public { 16 | counter += value; 17 | emit Incremented(msg.sender, value); 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /src/get-catalog/app.ts: -------------------------------------------------------------------------------- 1 | // tslint:disable: no-console 2 | 3 | import { ContractRegistry } from 'pegasys-orchestrate' 4 | 5 | export const start = async () => { 6 | try { 7 | const contractRegistry = new ContractRegistry(process.env.CONTRACT_REGISTRY_HOST!) 8 | 9 | const authToken = process.env.AUTH_TOKEN ? `Bearer ${process.env.AUTH_TOKEN}` : '' 10 | console.log(await contractRegistry.getCatalog(authToken)) 11 | } catch (error) { 12 | console.error(error) 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /src/register-chain/app.ts: -------------------------------------------------------------------------------- 1 | // tslint:disable: no-console 2 | 3 | import { ChainRegistry } from 'pegasys-orchestrate' 4 | 5 | export const start = async () => { 6 | try { 7 | const chainRegistry = new ChainRegistry(process.env.CHAIN_REGISTRY_HOST!) 8 | 9 | const chain = await chainRegistry.registerChain( 10 | { 11 | name: process.env.CHAIN!, 12 | urls: [process.env.NETWORK_ENDPOINT!] 13 | }, 14 | process.env.AUTH_TOKEN! 15 | ) 16 | 17 | console.log(chain) 18 | } catch (error) { 19 | console.error(error) 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /src/generate-account/app.ts: -------------------------------------------------------------------------------- 1 | // tslint:disable: no-console 2 | import { AccountGenerator } from 'pegasys-orchestrate' 3 | 4 | export const start = async () => { 5 | try { 6 | const accountGenerator = new AccountGenerator([process.env.KAFKA_HOST!], undefined, undefined, { 7 | groupId: 'quick-start' 8 | }) 9 | 10 | await accountGenerator.connect() 11 | const address = await accountGenerator.generateAccount({ 12 | authToken: process.env.AUTH_TOKEN ? `Bearer ${process.env.AUTH_TOKEN}` : '', 13 | chain: process.env.CHAIN! 14 | }) 15 | await accountGenerator.disconnect() 16 | 17 | console.log(address) 18 | } catch (error) { 19 | console.error(error) 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /CLA.md: -------------------------------------------------------------------------------- 1 | # Sign the CLA 2 | 3 | This page is the step-by-step guide to signing the Consensys AG 4 | Individual Contributor License Agreement. 5 | 6 | 1. First and foremost, read [the current version of the CLA]. 7 | It is written to be as close to plain English as possible. 8 | 9 | 2. Make an account on [GitHub] if you don't already have one. 10 | 11 | 3. After creating your first pull request, you will see a merge 12 | pre-requisite requiring to you read and sign the CLA. 13 | 14 | If you have any questions, you can reach us at [support@pegasys.tech]. 15 | 16 | [github]: https://github.com/ 17 | [the current version of the cla]: https://gist.github.com/rojotek/978b48a5e8b68836856a8961d6887992 18 | [support@pegasys.tech]: mailto:support@pegasys.tech 19 | -------------------------------------------------------------------------------- /src/create-faucet/app.ts: -------------------------------------------------------------------------------- 1 | // tslint:disable: no-console 2 | 3 | import { FaucetRegistry } from 'pegasys-orchestrate' 4 | 5 | export const start = async () => { 6 | try { 7 | const faucetRegistry = new FaucetRegistry(process.env.CHAIN_REGISTRY_HOST!) 8 | 9 | const faucet = await faucetRegistry.registerFaucet( 10 | { 11 | name: `${process.env.CHAIN}-faucet`, 12 | chainRule: process.env.CHAIN_UUID!, 13 | creditorAccount: process.env.FAUCET_ACCOUNT!, 14 | cooldown: '10s', 15 | amount: '60000000000000000', 16 | maxBalance: '100000000000000000' 17 | }, 18 | process.env.AUTH_TOKEN! 19 | ) 20 | 21 | console.log(faucet) 22 | } catch (error) { 23 | console.error(error) 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /src/deploy-contract/deploy.ts: -------------------------------------------------------------------------------- 1 | import { TransactionClient } from 'pegasys-orchestrate' 2 | import * as uuid from 'uuid' 3 | 4 | export const deploy = async () => { 5 | const txClient = new TransactionClient(process.env.TX_SCHEDULER_HOST!) 6 | 7 | // Deploy a new Counter contract and return the Transaction 8 | const idempotencyKey = uuid.v4() 9 | const authToken = process.env.AUTH_TOKEN ? `Bearer ${process.env.AUTH_TOKEN}` : undefined 10 | const txResponse = await txClient.deployContract( 11 | { 12 | chain: process.env.CHAIN!, 13 | params: { 14 | contractName: 'Counter', 15 | from: process.env.FROM_ACCOUNT! 16 | } 17 | }, 18 | idempotencyKey, 19 | authToken 20 | ) 21 | 22 | console.log('Transaction request sent successfully', txResponse) 23 | } 24 | -------------------------------------------------------------------------------- /src/send-tx/send-tx.ts: -------------------------------------------------------------------------------- 1 | import { TransactionClient } from 'pegasys-orchestrate' 2 | import * as uuid from 'uuid' 3 | 4 | export const sendTx = async () => { 5 | const txClient = new TransactionClient(process.env.TX_SCHEDULER_HOST!) 6 | const idempotencyKey = uuid.v4() 7 | const authToken = process.env.AUTH_TOKEN ? `Bearer ${process.env.AUTH_TOKEN}` : undefined 8 | 9 | const txResponse = await txClient.send( 10 | { 11 | chain: process.env.CHAIN!, 12 | params: { 13 | methodSignature: 'increment(uint256)', 14 | args: [1], 15 | to: process.env.TO_ACCOUNT!, 16 | from: process.env.FROM_ACCOUNT! 17 | } 18 | }, 19 | idempotencyKey, 20 | authToken 21 | ) 22 | 23 | console.log('Transaction request sent successfully', txResponse) 24 | } 25 | -------------------------------------------------------------------------------- /src/register-contract/app.ts: -------------------------------------------------------------------------------- 1 | // tslint:disable: no-console 2 | 3 | import { ContractRegistry } from 'pegasys-orchestrate' 4 | 5 | import * as Counter from '../../build/contracts/Counter.json' 6 | 7 | export const start = async () => { 8 | try { 9 | const contractRegistry = new ContractRegistry(process.env.CONTRACT_REGISTRY_HOST!) 10 | 11 | const authToken = process.env.AUTH_TOKEN ? `Bearer ${process.env.AUTH_TOKEN}` : '' 12 | await contractRegistry.register({ 13 | name: 'Counter', 14 | abi: Counter.abi, 15 | bytecode: Counter.bytecode, 16 | deployedBytecode: Counter.deployedBytecode, 17 | authToken 18 | }) 19 | 20 | console.log(await contractRegistry.get('Counter', undefined, authToken)) 21 | } catch (error) { 22 | console.error(error) 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /scripts/besu/Dockerfile: -------------------------------------------------------------------------------- 1 | 2 | 3 | FROM alpine:latest AS builder 4 | 5 | RUN apk --no-cache add \ 6 | curl \ 7 | tar 8 | 9 | RUN mkdir -p /pegasys-plus/plugins 10 | 11 | ARG BINTRAY_USER_NAME 12 | ARG BINTRAY_PASSWORD 13 | ARG PPLUS_VERSION 14 | 15 | # Download PegaSys Plus Plugins 16 | RUN curl -u $BINTRAY_USER_NAME:$BINTRAY_PASSWORD -L https://dl.bintray.com/consensys/pegasys-enterprise-repo/pegasys-plus-$PPLUS_VERSION.tar.gz -o pegasys-plus.tar.gz || echo "Could not download P+ plugins" 17 | RUN tar zxvf pegasys-plus.tar.gz || true 18 | RUN mv /pegasys-plus-$PPLUS_VERSION/plugins/* /pegasys-plus/plugins || true 19 | 20 | FROM hyperledger/besu:1.4 21 | 22 | COPY --from=builder /pegasys-plus/plugins /opt/besu/pegasys-plus/plugins 23 | 24 | ENV BESU_OPTS="-Dbesu.plugins.dir=/opt/besu/pegasys-plus/plugins" 25 | -------------------------------------------------------------------------------- /scripts/deps/config/hashicorp/init.sh: -------------------------------------------------------------------------------- 1 | # Init Vault 2 | curl --request POST --data '{"secret_shares": 1, "secret_threshold": 1}' ${VAULT_ADDR}/v1/sys/init > init.json 3 | 4 | # Retrieve root token and unseal key 5 | token=$(cat init.json | jq .root_token | tr -d '"') 6 | unseal_key=$(cat init.json | jq .keys | jq .[0]) 7 | rm init.json 8 | 9 | # Unseal Vault 10 | curl --request POST --data '{"key": '${unseal_key}'}' ${VAULT_ADDR}/v1/sys/unseal 11 | 12 | # Enable secret engine 13 | curl --header "X-Vault-Token: ${token}" --request POST \ 14 | --data '{"type": "kv-v2", "config": {"force_no_cache": true} }' \ 15 | ${VAULT_ADDR}/v1/sys/mounts/secret 16 | 17 | # Store root token in a file so it can be shared with other services throug volume 18 | mkdir -p /vault/token 19 | touch /vault/token/.vault-token 20 | echo $token > /vault/token/.vault-token 21 | -------------------------------------------------------------------------------- /src/send-private-tx/send-private-tx.ts: -------------------------------------------------------------------------------- 1 | import { ProtocolType, TransactionClient } from 'pegasys-orchestrate' 2 | import * as uuid from 'uuid' 3 | 4 | export const sendTx = async () => { 5 | const txClient = new TransactionClient(process.env.TX_SCHEDULER_HOST!) 6 | const idempotencyKey = uuid.v4() 7 | const authToken = process.env.AUTH_TOKEN ? `Bearer ${process.env.AUTH_TOKEN}` : undefined 8 | 9 | const txResponse = await txClient.deployContract( 10 | { 11 | chain: process.env.CHAIN!, 12 | params: { 13 | contractName: 'Counter', 14 | from: process.env.FROM_ACCOUNT!, 15 | protocol: ProtocolType.Orion, 16 | privateFor: ['k2zXEin4Ip/qBGlRkJejnGWdP9cjkK+DAvKNW31L2C8='], // Orion node 3 public key 17 | privateFrom: 'Ko2bVqD+nNlNYL5EE7y3IdOnviftjiizpjRt+HTuFBs=' // Orion node 2 public key (the registered chain) 18 | } 19 | }, 20 | idempotencyKey, 21 | authToken 22 | ) 23 | 24 | console.log('Transaction request sent successfully', txResponse) 25 | } 26 | -------------------------------------------------------------------------------- /src/consume/consume.ts: -------------------------------------------------------------------------------- 1 | import { Consumer, EventType, ResponseMessage } from 'pegasys-orchestrate' 2 | 3 | const STOP_MSG = 4 | '\n\n---------------------------------------------\nStop consumer by pressing ctrl+c at the end of the quickstart.\n---------------------------------------------\n' 5 | 6 | export const consume = async () => { 7 | const consumer = new Consumer([process.env.KAFKA_HOST!]) 8 | 9 | await consumer.connect() 10 | console.error(STOP_MSG) 11 | 12 | consumer.on(EventType.Response, async (responseMessage: ResponseMessage) => { 13 | const { offset, topic, value } = responseMessage.content() 14 | 15 | console.log('Message received !', { envelopeId: value.id, offset, topic, chain: value.chain }) 16 | if (value.errors && value.errors.length > 0) { 17 | console.error('Transaction failed with error: ', value.errors) 18 | } else { 19 | console.log('RequestId:', value.id) 20 | console.log('Receipt: ', value.receipt) 21 | } 22 | 23 | await responseMessage.commit() 24 | console.error(STOP_MSG) 25 | }) 26 | 27 | await consumer.consume() 28 | } 29 | -------------------------------------------------------------------------------- /tslint.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": ["tslint:recommended", "tslint-config-prettier"], 3 | "linterOptions": { 4 | "exclude": ["**/node_modules/**/*", "./src/stubs/*"] 5 | }, 6 | "jsRules": {}, 7 | "rules": { 8 | "indent": [true, "spaces"], 9 | "quotemark": [true, "single"], 10 | "object-literal-sort-keys": false, 11 | "trailing-comma": false, 12 | "class-name": true, 13 | "semicolon": false, 14 | "no-submodule-imports": [true], 15 | "no-implicit-dependencies": [true, "dev"], 16 | "triple-equals": [true, "allow-null-check"], 17 | "eofline": true, 18 | "jsdoc-format": true, 19 | "member-access": false, 20 | "whitespace": [true, "check-decl", "check-operator", "check-separator", "check-type"], 21 | "curly": true, 22 | "only-arrow-functions": false, 23 | "no-empty-interface": false, 24 | "ordered-imports": [ 25 | true, 26 | { 27 | "grouped-imports": true 28 | } 29 | ], 30 | "no-trailing-whitespace": true, 31 | "no-floating-promises": { "severity": "warning" }, 32 | "no-console": false 33 | }, 34 | "rulesDirectory": [] 35 | } 36 | -------------------------------------------------------------------------------- /scripts/besu/config/log-config.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | INFO 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | -------------------------------------------------------------------------------- /.env.besu.example: -------------------------------------------------------------------------------- 1 | ## Orchestrate services endpoint hosts 2 | CHAIN_REGISTRY_HOST=http://localhost:8011 3 | CONTRACT_REGISTRY_HOST=localhost:8020 4 | TX_SCHEDULER_HOST=http://localhost:8031 5 | KAFKA_HOST=localhost:9092 6 | 7 | # Before running command `npm run deploy` and/or 'npm run send-tx` 8 | # set the address used as sender for transaction 9 | FROM_ACCOUNT= 10 | 11 | # Before running command `npm run send-tx` set the address of the account to 12 | # send transactions to. 13 | # It corresponds to the address of the Counter Smart Contract 14 | # deployed using `npm run deploy` 15 | TO_ACCOUNT= 16 | 17 | # Chain name of chain used in the examples. 18 | CHAIN=besu 19 | 20 | # Chain UUID 21 | CHAIN_UUID= 22 | 23 | # Network RPC endpoint used for the Besu network. 24 | # This is the Docker network address. 25 | NETWORK_ENDPOINT=http://validator2:8545 26 | 27 | # Once an account created on the network, you can use it as a faucet account. 28 | # insert this account address here before running the `npm run create-faucet` 29 | FAUCET_ACCOUNT= 30 | 31 | # Next variable refers to the usage of multi-tenancy 32 | # Go to following link to learn more about it 33 | # https://docs.orchestrate.pegasys.tech/en/latest/Howto/Configure/Configure-MultiTenancy/ 34 | AUTH_API_KEY=with-key 35 | MULTI_TENANCY_ENABLED=false 36 | AUTH_JWT_CLAIMS_NAMESPACE=orchestrate.info 37 | AUTH_JWT_CERTIFICATE= 38 | AUTH_JWT_PRIVATE_KEY= -------------------------------------------------------------------------------- /scripts/kafka/initTopics.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # Exit on error 4 | set -Eeu 5 | 6 | # "source .env" does not work when it contains string array 7 | # As a temporary fix we hard-paste the values we need from .env here. 8 | TX_CRAFTER=tx-crafter 9 | TX_NONCE=tx-nonce 10 | TX_SIGNER=tx-signer 11 | TX_SENDER=tx-sender 12 | TX_LISTENER=tx-listener 13 | TX_DECODER=tx-decoder 14 | TX_DECODED=tx-decoded 15 | TX_RECOVER=tx-recover 16 | ACCOUNT_GENERATED=account-generated 17 | ACCOUNT_GENERATOR=account-generator 18 | 19 | echo "Creating topics if not exist..." 20 | RETRY=10 21 | TOPICS=($TX_CRAFTER $TX_NONCE $TX_SIGNER $TX_SENDER $TX_DECODED $TX_RECOVER $ACCOUNT_GENERATED $ACCOUNT_GENERATOR) 22 | 23 | for NAME in ${TOPICS[@]} 24 | do 25 | # Retry 10 times if could not create topic 26 | n=10 27 | for i in $(seq 1 1 $RETRY) 28 | do 29 | docker-compose -f scripts/deps/docker-compose.yml exec kafka kafka-topics --create --partitions 1 --replication-factor 1 --if-not-exists --zookeeper zookeeper:32181 --topic topic-$NAME && break 30 | echo " 31 | ======================================================================= 32 | Attempt $i/$RETRY (retry in 2 seconds) - could not create topic-$NAME 33 | ======================================================================= 34 | " 35 | if [ $i = $RETRY ]; then 36 | echo "Stopping ..." 37 | exit 38 | fi 39 | # Sleep 2 seconds if not succeded 40 | sleep 2 41 | done 42 | done 43 | 44 | echo "...topics created." 45 | -------------------------------------------------------------------------------- /.env.infura-rinkeby.example: -------------------------------------------------------------------------------- 1 | ## Orchestrate services endpoint hosts 2 | CHAIN_REGISTRY_HOST=http://localhost:8011 3 | CONTRACT_REGISTRY_HOST=localhost:8020 4 | TX_SCHEDULER_HOST=http://localhost:8031 5 | KAFKA_HOST=localhost:9092 6 | 7 | # Before running command `npm run deploy` 8 | # or 'npm run send-tx` set the address used as sender 9 | # for transaction 10 | FROM_ACCOUNT= 11 | 12 | # Before running command `npm run send-tx` set 13 | # the address of the account to send transactions to 14 | # It corresponds to the address of the Counter Smart Contract 15 | # deployed using `npm run deploy` 16 | TO_ACCOUNT= 17 | 18 | # Chain used in this environment is Rinkeby. 19 | CHAIN=rinkeby 20 | 21 | # Chain UUID 22 | CHAIN_UUID= 23 | 24 | # Network RPC endpoint used for the Rinkeby network. 25 | # This is the Infura network address of your project endpoint. 26 | # Replace by your Infura.io Rinkeby project ID. 27 | NETWORK_ENDPOINT=https://rinkeby.infura.io/v3/ 28 | 29 | # Once an account created on the network, you can use it as a faucet account. 30 | # insert this account address here before running the `npm run create-faucet` 31 | FAUCET_ACCOUNT= 32 | 33 | # Next variable refers to the usage of multi-tenancy 34 | # Go to following link to learn more about it 35 | # https://docs.orchestrate.pegasys.tech/en/latest/Howto/Configure/Configure-MultiTenancy/ 36 | AUTH_API_KEY=with-key 37 | MULTI_TENANCY_ENABLED=false 38 | AUTH_JWT_CLAIMS_NAMESPACE=orchestrate.info 39 | AUTH_JWT_CERTIFICATE= 40 | AUTH_JWT_PRIVATE_KEY= -------------------------------------------------------------------------------- /GOVERNANCE.md: -------------------------------------------------------------------------------- 1 | # Overview 2 | 3 | This project is led by a benevolent dictator (PegaSys) and managed by the community. That is, the community actively contributes to the day-to-day maintenance of the project, but the general strategic line is drawn by the benevolent dictator. In case of disagreement, they have the last word. It is the benevolent dictator’s job to resolve disputes within the community and to ensure that the project is able to progress in a coordinated way. In turn, it is the community’s job to guide the decisions of the benevolent dictator through active engagement and contribution. 4 | 5 | # Principles 6 | 7 | The community adheres to the following principles: 8 | 9 | - Partially-open: orchestrate core is closed source. orchestrate-node, orchestrate-quick-start, orchestrate-helm, orchestrate-kubernetes are open source. See repository guidelines and CLA, below. 10 | - Welcoming and respectful: See Code of Conduct, below. 11 | - Transparent and accessible: Work and collaboration should be done in public. 12 | - Merit: Ideas and contributions are accepted according to their technical merit and alignment with project objectives and design principles. 13 | 14 | # Code of Conduct 15 | 16 | See [code of conduct] 17 | 18 | # Community membership 19 | 20 | See [community membership] 21 | 22 | # Decision Making 23 | 24 | Decision making will be handled by the Approvers (see [community membership]). If consensus cannot be reached, the Benevolent Dictator will provide the final word on the decision. 25 | 26 | # CLA 27 | 28 | All contributors must sign the CLA, as described in [CLA.md]. 29 | 30 | ## Attribution 31 | 32 | This document was influenced by the following: 33 | 34 | - Kubernetes community-membership.md, available at [kub community membership]. 35 | - Kubernetes governance.md, available at [kub governance] 36 | - OSSWatch Benevolent Dictator Governance Model, available at [oss watch benevolent dictator]. 37 | 38 | [cla.md]: /CLA.md 39 | [community membership]: /community-membership.md 40 | [code of conduct]: /CODE-OF-CONDUCT.md 41 | [oss watch benevolent dictator]: http://oss-watch.ac.uk/resources/benevolentdictatorgovernancemodel 42 | [kub community membership]: https://raw.githubusercontent.com/kubernetes/community/master/community-membership.md 43 | [kub governance]: https://github.com/kubernetes/community/blob/master/governance.md 44 | -------------------------------------------------------------------------------- /scripts/besu/docker-compose.yml: -------------------------------------------------------------------------------- 1 | --- 2 | version: '3.4' 3 | 4 | x-orion-common: &orion-common 5 | image: pegasyseng/orion:1.5 6 | entrypoint: ["bash", "orion.sh"] 7 | networks: 8 | - orchestrate 9 | volumes: 10 | - ./orion.sh:/opt/orion/orion.sh 11 | - ./config:/config 12 | 13 | x-orion-env-common: &orion-env-common 14 | LOG4J_CONFIGURATION_FILE: /config/log-config.xml 15 | 16 | x-besu-common: &besu-common 17 | image: besu-pplus 18 | entrypoint: ["bash", "besu.sh"] 19 | networks: 20 | - orchestrate 21 | volumes: 22 | - public-keys:/opt/besu/public-keys/ 23 | - ./besu.sh:/opt/besu/besu.sh 24 | - ./config:/config 25 | 26 | x-besu-env-common: &besu-env-common 27 | RPC_HTTP_API: WEB3,ETH,NET,EEA,PRIV,ADMIN,PERM,TXPOOL,ibft 28 | RPC_WS_API: WEB3,ETH,NET,EEA,PRIV,ADMIN,PERM,TXPOOL,ibft 29 | METRICS: 1 30 | LOG4J_CONFIGURATION_FILE: /config/log-config.xml 31 | 32 | services: 33 | validator1-bootnode: 34 | <<: *besu-common 35 | build: 36 | context: . 37 | args: 38 | BINTRAY_USER_NAME: ${BINTRAY_USER_NAME-} 39 | BINTRAY_PASSWORD: ${BINTRAY_PASSWORD-} 40 | PPLUS_VERSION: 1.0.1-SNAPSHOT 41 | environment: 42 | <<: *besu-env-common 43 | NODE_NAME: validator1-bootnode 44 | ORION_URL: http://orion1:8888 45 | ORION_NAME: orion1 46 | BOOTNODE: 1 47 | ports: 48 | - 8540:8545 49 | depends_on: 50 | - orion1 51 | 52 | orion1: 53 | <<: *orion-common 54 | environment: 55 | <<: *orion-env-common 56 | ORION_NAME: orion1 57 | 58 | validator2: 59 | <<: *besu-common 60 | environment: 61 | <<: *besu-env-common 62 | NODE_NAME: validator2 63 | ORION_URL: http://orion2:8888 64 | ORION_NAME: orion2 65 | ports: 66 | - 8544:8545 67 | depends_on: 68 | - orion2 69 | - validator1-bootnode 70 | 71 | orion2: 72 | <<: *orion-common 73 | environment: 74 | <<: *orion-env-common 75 | ORION_NAME: orion2 76 | depends_on: 77 | - orion1 78 | 79 | validator3: 80 | <<: *besu-common 81 | environment: 82 | <<: *besu-env-common 83 | NODE_NAME: validator3 84 | ORION_URL: http://orion3:8888 85 | ORION_NAME: orion3 86 | ports: 87 | - 8545:8545 88 | depends_on: 89 | - validator1-bootnode 90 | - orion3 91 | 92 | orion3: 93 | <<: *orion-common 94 | environment: 95 | <<: *orion-env-common 96 | ORION_NAME: orion3 97 | depends_on: 98 | - orion1 99 | 100 | networks: 101 | orchestrate: 102 | external: 103 | name: deps_orchestrate 104 | 105 | volumes: 106 | public-keys: 107 | prometheus: 108 | grafana: 109 | vault-token: 110 | driver: local 111 | -------------------------------------------------------------------------------- /CODE-OF-CONDUCT.md: -------------------------------------------------------------------------------- 1 | # Contributor Covenant Code of Conduct 2 | 3 | ## Our Pledge 4 | 5 | In the interest of fostering an open and welcoming environment, we as 6 | contributors and maintainers pledge to making participation in our project and 7 | our community a harassment-free experience for everyone, regardless of age, body 8 | size, disability, ethnicity, sex characteristics, gender identity and expression, 9 | level of experience, education, socio-economic status, nationality, personal 10 | appearance, race, religion, or sexual identity and orientation. 11 | 12 | ## Our Standards 13 | 14 | Examples of behavior that contributes to creating a positive environment 15 | include: 16 | 17 | - Using welcoming and inclusive language 18 | - Being respectful of differing viewpoints and experiences 19 | - Gracefully accepting constructive criticism 20 | - Focusing on what is best for the community 21 | - Showing empathy towards other community members 22 | 23 | Examples of unacceptable behavior by participants include: 24 | 25 | - The use of sexualized language or imagery and unwelcome sexual attention or 26 | advances 27 | - Trolling, insulting/derogatory comments, and personal or political attacks 28 | - Public or private harassment 29 | - Publishing others' private information, such as a physical or electronic 30 | address, without explicit permission 31 | - Other conduct which could reasonably be considered inappropriate in a 32 | professional setting 33 | 34 | ## Our Responsibilities 35 | 36 | Project maintainers are responsible for clarifying the standards of acceptable 37 | behavior and are expected to take appropriate and fair corrective action in 38 | response to any instances of unacceptable behavior. 39 | 40 | Project maintainers have the right and responsibility to remove, edit, or 41 | reject comments, commits, code, wiki edits, issues, and other contributions 42 | that are not aligned to this Code of Conduct, or to ban temporarily or 43 | permanently any contributor for other behaviors that they deem inappropriate, 44 | threatening, offensive, or harmful. 45 | 46 | ## Scope 47 | 48 | This Code of Conduct applies both within project spaces and in public spaces 49 | when an individual is representing the project or its community. Examples of 50 | representing a project or community include using an official project e-mail 51 | address, posting via an official social media account, or acting as an appointed 52 | representative at an online or offline event. Representation of a project may be 53 | further defined and clarified by project maintainers. 54 | 55 | ## Enforcement 56 | 57 | Instances of abusive, harassing, or otherwise unacceptable behavior may be 58 | reported by contacting the project team at [private@pegasys.tech]. All 59 | complaints will be reviewed and investigated and will result in a response that 60 | is deemed necessary and appropriate to the circumstances. The project team is 61 | obligated to maintain confidentiality with regard to the reporter of an incident. 62 | Further details of specific enforcement policies may be posted separately. 63 | 64 | Project maintainers who do not follow or enforce the Code of Conduct in good 65 | faith may face temporary or permanent repercussions as determined by other 66 | members of the project's leadership. 67 | 68 | ## Attribution 69 | 70 | This Code of Conduct is adapted from the [Contributor Covenant], version 1.4, 71 | available at https://www.contributor-covenant.org/version/1/4/code-of-conduct.html 72 | 73 | [contributor covenant]: https://www.contributor-covenant.org 74 | [private@pegasys.tech]: mailto:private@pegasys.tech 75 | -------------------------------------------------------------------------------- /scripts/deps/docker-compose.yml: -------------------------------------------------------------------------------- 1 | version: '3.7' 2 | 3 | x-container-common: &container-common 4 | restart: ${CONTAINER_RESTART-on-failure} 5 | networks: 6 | - orchestrate 7 | 8 | x-postgres-common: &postgres-common 9 | environment: 10 | POSTGRES_PASSWORD: postgres 11 | 12 | services: 13 | zookeeper: 14 | <<: *container-common 15 | image: confluentinc/cp-zookeeper:5.3.0 16 | ports: 17 | - ${ZOOKEEPER_EXTERNAL_PORT-2181}:2181 18 | environment: 19 | ZOOKEEPER_CLIENT_PORT: ${ZOOKEEPER_CLIENT_PORT-32181} 20 | ZOOKEEPER_TICK_TIME: ${ZOOKEEPER_TICK_TIME-2000} 21 | 22 | kafka: 23 | <<: *container-common 24 | image: confluentinc/cp-kafka:5.3.0 25 | depends_on: 26 | - zookeeper 27 | ports: 28 | - ${KAFKA_EXTERNAL_PORT-9092}:9092 29 | environment: 30 | KAFKA_BROKER_ID: 1 31 | KAFKA_ZOOKEEPER_CONNECT: zookeeper:${ZOOKEEPER_CLIENT_PORT-32181} 32 | KAFKA_OFFSETS_TOPIC_REPLICATION_FACTOR: 1 33 | KAFKA_ADVERTISED_LISTENERS: INTERNAL://kafka:29092,EXTERNAL://${KAFKA_EXTERNAL_HOSTNAME-localhost}:${KAFKA_EXTERNAL_PORT-9092} 34 | KAFKA_LISTENER_SECURITY_PROTOCOL_MAP: INTERNAL:PLAINTEXT,EXTERNAL:PLAINTEXT 35 | KAFKA_INTER_BROKER_LISTENER_NAME: INTERNAL 36 | 37 | redis: 38 | <<: *container-common 39 | image: redis:5.0-alpine 40 | command: redis-server /usr/local/etc/redis/redis.conf 41 | ports: 42 | - 6379:6379 43 | volumes: 44 | - ./config/redis/redis.conf:/usr/local/etc/redis/redis.conf 45 | 46 | postgres-contract-registry: 47 | <<: *container-common 48 | <<: *postgres-common 49 | image: postgres:10.12-alpine 50 | ports: 51 | - 5432 52 | volumes: 53 | - db-data-contract-registry:/var/lib/postgresql/data 54 | 55 | postgres-transaction-scheduler: 56 | <<: *container-common 57 | <<: *postgres-common 58 | image: postgres:10.12-alpine 59 | volumes: 60 | - db-data-transaction-scheduler:/var/lib/postgresql/data 61 | ports: 62 | - 5432 63 | 64 | postgres-chain-registry: 65 | <<: *container-common 66 | <<: *postgres-common 67 | image: postgres:10.12-alpine 68 | volumes: 69 | - db-data-chain-registry:/var/lib/postgresql/data 70 | ports: 71 | - 5432 72 | 73 | vault: 74 | <<: *container-common 75 | image: library/vault:1.1.1 76 | tty: true 77 | cap_add: 78 | - IPC_LOCK 79 | ports: 80 | - 9999:8200 81 | volumes: 82 | - ./config/hashicorp/config.hcl:/vault/config.hcl:ro 83 | entrypoint: vault server -config=/vault 84 | 85 | vault-init: 86 | <<: *container-common 87 | # image: library/vault:1.1.1 88 | build: ./config/hashicorp 89 | environment: 90 | VAULT_ADDR: ${VAULT_ADDR-http://vault:8200} 91 | restart: 'no' 92 | depends_on: 93 | - vault 94 | volumes: 95 | - vault-token:/vault/token 96 | - ./config/hashicorp/init.sh:/init.sh 97 | command: sh /init.sh 98 | 99 | jaeger: 100 | <<: *container-common 101 | image: jaegertracing/all-in-one:1.8 102 | environment: 103 | COLLECTOR_ZIPKIN_HTTP_PORT: 9411 104 | ports: 105 | - 5775:5775/udp 106 | - 6831:6831/udp 107 | - 6832:6832/udp 108 | - 5778:5778 109 | - 16686:16686 110 | - 14268:14268 111 | - 9411:9411 112 | 113 | volumes: 114 | db-data-contract-registry: 115 | driver: local 116 | db-data-transaction-scheduler: 117 | driver: local 118 | db-data-chain-registry: 119 | driver: local 120 | chain-data: 121 | driver: local 122 | vault-token: 123 | driver: local 124 | 125 | networks: 126 | orchestrate: 127 | driver: bridge 128 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "pegasys-orchestrate-quick-start", 3 | "version": "2.3.0", 4 | "description": "PegaSys Orchestrate Quick start", 5 | "config": { 6 | "services": "tx-crafter tx-signer tx-sender tx-listener contract-registry chain-registry transaction-scheduler" 7 | }, 8 | "scripts": { 9 | "lint": "tslint -p . -c tslint.json", 10 | "lint:fix": "npm run lint -- --fix", 11 | "format": "prettier --write 'src/**/*.{ts,js,json}'", 12 | "check-formatting": "prettier --list-different 'src/**/*.{ts,js,json}'", 13 | "clean": "rimraf ./dist ./build", 14 | "compile": "truffle compile", 15 | "generate-account": "dotenv ts-node src/generate-account", 16 | "register-chain": "dotenv ts-node src/register-chain", 17 | "get-latest-block": "dotenv -- cross-var curl -X POST -H 'Authorization: Bearer %AUTH_TOKEN%' --data '{\"jsonrpc\":\"2.0\",\"method\":\"eth_getBlockByNumber\",\"params\":[\"latest\", false],\"id\":1}' %CHAIN_REGISTRY_HOST%/%CHAIN_UUID%", 18 | "create-faucet": "dotenv ts-node src/create-faucet", 19 | "register-contract": "dotenv ts-node src/register-contract", 20 | "get-catalog": "dotenv ts-node src/get-catalog", 21 | "consume": "dotenv ts-node src/consume", 22 | "deploy": "dotenv ts-node src/deploy-contract", 23 | "send-tx": "dotenv ts-node src/send-tx", 24 | "send-private-tx": "dotenv ts-node src/send-private-tx", 25 | "orchestrate": "orchestrate", 26 | "generate-jwt": "docker-compose run generate-jwt", 27 | "up-deps": "docker-compose -f scripts/deps/docker-compose.yml up -d", 28 | "up-besu": "docker-compose -f scripts/besu/docker-compose.yml up -d", 29 | "up-orchestrate": "docker-compose up -d ${npm_package_config_services}", 30 | "stop-orchestrate": "docker-compose stop ${npm_package_config_services}", 31 | "down-orchestrate": "docker-compose down --volumes --timeout 0", 32 | "down-deps": "docker-compose -f scripts/deps/docker-compose.yml down --volumes --timeout 0", 33 | "down-besu": "docker-compose -f scripts/besu/docker-compose.yml down --volumes --timeout 0", 34 | "up": "npm run up-deps && sleep 5 &&npm run up-orchestrate", 35 | "down": "npm run down-orchestrate ; npm run down-besu ; npm run down-deps", 36 | "hashicorp-accounts": "bash scripts/deps/config/hashicorp/vault.sh kv list secret/default", 37 | "hashicorp-token-lookup": "bash scripts/deps/config/hashicorp/vault.sh token lookup", 38 | "hashicorp-vault": "bash -x scripts/deps/config/hashicorp/vault.sh" 39 | }, 40 | "repository": { 41 | "type": "git", 42 | "url": "https://gitlab.com/ConsenSys/client/fr/core-stack/quick-start.git" 43 | }, 44 | "keywords": [ 45 | "Blockchain", 46 | "Ethereum", 47 | "Pegasys", 48 | "Orchestrate", 49 | "Transaction" 50 | ], 51 | "author": "ConsenSys PegaSys Engineering", 52 | "contributors": [ 53 | "Dario Anongba Varela ", 54 | "Nicolas Maurice ", 55 | "Gabriel Garrido Calvo " 56 | ], 57 | "license": "Apache-2.0", 58 | "bugs": { 59 | "url": "https://gitlab.com/ConsenSys/client/fr/core-stack/quick-start/issues" 60 | }, 61 | "homepage": "https://gitlab.com/ConsenSys/client/fr/core-stack/quick-start", 62 | "devDependencies": { 63 | "@types/uuid": "~8.0.0", 64 | "axios": "~0.19.2", 65 | "cross-var": "~1.1.0", 66 | "dotenv": "~8.2.0", 67 | "dotenv-cli": "~3.1.0", 68 | "ethers": "~5.0.8", 69 | "husky": "~4.2.5", 70 | "lint-staged": "~10.2.2", 71 | "pegasys-orchestrate": "~3.1.2", 72 | "prettier": "~2.0.5", 73 | "rimraf": "~3.0.2", 74 | "truffle": "~5.1.35", 75 | "ts-node": "~8.10.1", 76 | "tslint": "~6.1.2", 77 | "tslint-config-prettier": "~1.18.0", 78 | "typescript": "~3.8.3", 79 | "uuid": "~8.3.0" 80 | }, 81 | "husky": { 82 | "hooks": { 83 | "pre-commit": "lint-staged" 84 | } 85 | }, 86 | "lint-staged": { 87 | "*.{json,md}": [ 88 | "prettier --write", 89 | "git add" 90 | ], 91 | "*.{ts,tsx}": [ 92 | "prettier --write", 93 | "tslint", 94 | "git add" 95 | ] 96 | } 97 | } 98 | -------------------------------------------------------------------------------- /scripts/besu/besu.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | rm -rf /opt/besu/database 4 | 5 | echo "BESU_OPTS: $BESU_OPTS" 6 | 7 | # Initialize command 8 | cmd="/opt/besu/bin/besu" 9 | 10 | # Set P2P flag 11 | p2p_host=`awk 'END{print $1}' /etc/hosts` 12 | cmd="${cmd} --p2p-host=${p2p_host}" 13 | 14 | # Set Bootnode flag 15 | if [[ ! -z "${BOOTNODE}" ]]; 16 | then 17 | echo "Starting as Bootnode" 18 | # Save bootnode PKEY in volume 19 | /opt/besu/bin/besu public-key export --to="/opt/besu/public-keys/bootnode.pub" 20 | cmd="${cmd} --bootnodes" 21 | else 22 | # Wait for bootnode public key to be generated 23 | while [ ! -f "/opt/besu/public-keys/bootnode.pub" ] 24 | do 25 | sleep 1 26 | done 27 | 28 | # Extract bootnode PKEY from volume 29 | bootnode_pubkey=`sed 's/^0x//' /opt/besu/public-keys/bootnode.pub` 30 | boonode_ip=`getent hosts validator1-bootnode | awk '{ print $1 }'` 31 | bootnode_enode="enode://${bootnode_pubkey}@${boonode_ip}:30303" 32 | cmd="${cmd} --bootnodes=${bootnode_enode}" 33 | fi 34 | 35 | # Set Orion privacy configuration 36 | if [[ ! -z "${ORION_URL}" ]]; then 37 | echo "Starting with Orion Privacy enabled" 38 | cmd="${cmd} \ 39 | --privacy-enabled=true \ 40 | --privacy-url=${ORION_URL} \ 41 | --privacy-public-key-file=/config/${ORION_NAME}/nodeKey.pub"; 42 | fi 43 | 44 | # Set RPC HTTP options 45 | if [[ ! -z "${RPC_HTTP_API}" ]]; then 46 | echo "JSON-RPC HTTP enabled" 47 | cmd="${cmd} \ 48 | --rpc-http-enabled \ 49 | --rpc-http-api=${RPC_HTTP_API} \ 50 | --rpc-http-host=0.0.0.0 \ 51 | --rpc-http-port=8545 \ 52 | --rpc-http-cors-origins=\"*\"" 53 | fi 54 | 55 | # Set RPC WS options 56 | if [[ ! -z "${RPC_WS_API}" ]]; then 57 | echo "JSON-RPC WS enabled" 58 | cmd="${cmd} \ 59 | --rpc-ws-enabled \ 60 | --rpc-ws-api=${RPC_WS_API} \ 61 | --rpc-ws-host=0.0.0.0 \ 62 | --rpc-ws-port=8546" 63 | fi 64 | 65 | # Set GraphQL options 66 | if [[ ! -z "${GRAPHQL}" ]]; then 67 | echo "GraphQL enabled" 68 | cmd="${cmd} \ 69 | --graphql-http-enabled \ 70 | --graphql-http-host=0.0.0.0 \ 71 | --graphql-http-port=8547 \ 72 | --graphql-http-cors-origins=\"*\"" 73 | fi 74 | 75 | # Set GraphQL options 76 | if [[ ! -z "${METRICS}" ]]; then 77 | echo "Metrics enabled" 78 | cmd="${cmd} \ 79 | --metrics-enabled \ 80 | --metrics-host=0.0.0.0 \ 81 | --metrics-port=9545" 82 | fi 83 | 84 | # Set Kafka lugin 85 | if [[ ! -z "${PPLUS_KAFKA_ENABLED}" ]]; then 86 | cmd="${cmd} \ 87 | --plugin-kafka-enabled \ 88 | --plugin-kafka-stream=${PPLUS_KAFKA_STREAM} \ 89 | --plugin-kafka-url=${PPLUS_KAFKA_URL} \ 90 | --plugin-kafka-producer-property=bootstrap.servers=${PPLUS_KAFKA_URL} \ 91 | --plugin-kafka-producer-property=ssl.endpoint.identification.algorithm=https \ 92 | --plugin-kafka-producer-property=sasl.mechanism=PLAIN \ 93 | --plugin-kafka-producer-property=request.timeout.ms=20000 \ 94 | --plugin-kafka-producer-property=retry.backoff.ms=500 \ 95 | --plugin-kafka-producer-property=\"sasl.jaas.config=org.apache.kafka.utils.security.plain.PlainLoginModule required username=${PPLUS_KAFKA_USERNAME} password=${PPLUS_KAFKA_PASSWORD};\" \ 96 | --plugin-kafka-producer-property=security.protocol=SASL_SSL 97 | " 98 | fi 99 | 100 | # Set Account Permissioning options 101 | if [[ ! -z "${ACCOUNTS_ON_CHAIN_PERMISSIONING}" ]]; then 102 | echo "Account on chain permissioning enabled" 103 | cmd="${cmd} \ 104 | --permissions-accounts-contract-enabled \ 105 | --permissions-accounts-contract-address=0x0000000000000000000000000000000000008888" 106 | fi 107 | 108 | # Set Node Permissioning options 109 | if [[ ! -z "${NODES_ON_CHAIN_PERMISSIONING}" ]]; 110 | then 111 | echo "Nodes on chain permissioning enabled" 112 | cmd="${cmd} \ 113 | --permissions-nodes-contract-enabled \ 114 | --permissions-nodes-contract-address=0x0000000000000000000000000000000000009999" 115 | else 116 | cmd="${cmd} --host-whitelist=\"*\"" 117 | fi 118 | 119 | cmd="${cmd} \ 120 | --genesis-file=/config/genesis.json \ 121 | --min-gas-price=0 \ 122 | --data-path=/opt/besu/data \ 123 | --node-private-key-file=/config/${NODE_NAME}/keys/key.priv \ 124 | --revert-reason-enabled" 125 | 126 | echo ${cmd} 127 | eval $cmd 128 | -------------------------------------------------------------------------------- /scripts/deps/config/redis/redis.conf: -------------------------------------------------------------------------------- 1 | ############################# EVENT NOTIFICATION ############################## 2 | 3 | # Redis can notify Pub/Sub clients about events happening in the key space. 4 | # This feature is documented at http://redis.io/topics/notifications 5 | # 6 | # For instance if keyspace events notification is enabled, and a client 7 | # performs a DEL operation on key "foo" stored in the Database 0, two 8 | # messages will be published via Pub/Sub: 9 | # 10 | # PUBLISH __keyspace@0__:foo del 11 | # PUBLISH __keyevent@0__:del foo 12 | # 13 | # It is possible to select the events that Redis will notify among a set 14 | # of classes. Every class is identified by a single character: 15 | # 16 | # K Keyspace events, published with __keyspace@__ prefix. 17 | # E Keyevent events, published with __keyevent@__ prefix. 18 | # g Generic commands (non-type specific) like DEL, EXPIRE, RENAME, ... 19 | # $ String commands 20 | # l List commands 21 | # s Set commands 22 | # h Hash commands 23 | # z Sorted set commands 24 | # x Expired events (events generated every time a key expires) 25 | # e Evicted events (events generated when a key is evicted for maxmemory) 26 | # A Alias for g$lshzxe, so that the "AKE" string means all the events. 27 | # 28 | # The "notify-keyspace-events" takes as argument a string that is composed 29 | # of zero or multiple characters. The empty string means that notifications 30 | # are disabled. 31 | # 32 | # Example: to enable list and generic events, from the point of view of the 33 | # event name, use: 34 | # 35 | # notify-keyspace-events Elg 36 | # 37 | # Example 2: to get the stream of the expired keys subscribing to channel 38 | # name __keyevent@0__:expired use: 39 | # 40 | # notify-keyspace-events Ex 41 | # 42 | # By default all notifications are disabled because most users don't need 43 | # this feature and the feature has some overhead. Note that if you don't 44 | # specify at least one of K or E, no events will be delivered. 45 | notify-keyspace-events Kg 46 | 47 | ############################## MEMORY MANAGEMENT ################################ 48 | 49 | # Set a memory usage limit to the specified amount of bytes. 50 | # When the memory limit is reached Redis will try to remove keys 51 | # according to the eviction policy selected (see maxmemory-policy). 52 | # 53 | # If Redis can't remove keys according to the policy, or if the policy is 54 | # set to 'noeviction', Redis will start to reply with errors to commands 55 | # that would use more memory, like SET, LPUSH, and so on, and will continue 56 | # to reply to read-only commands like GET. 57 | # 58 | # This option is usually useful when using Redis as an LRU or LFU cache, or to 59 | # set a hard memory limit for an instance (using the 'noeviction' policy). 60 | # 61 | # WARNING: If you have replicas attached to an instance with maxmemory on, 62 | # the size of the output buffers needed to feed the replicas are subtracted 63 | # from the used memory count, so that network problems / resyncs will 64 | # not trigger a loop where keys are evicted, and in turn the output 65 | # buffer of replicas is full with DELs of keys evicted triggering the deletion 66 | # of more keys, and so forth until the database is completely emptied. 67 | # 68 | # In short... if you have replicas attached it is suggested that you set a lower 69 | # limit for maxmemory so that there is some free RAM on the system for replica 70 | # output buffers (but this is not needed if the policy is 'noeviction'). 71 | # 72 | maxmemory 100mb 73 | 74 | # MAXMEMORY POLICY: how Redis will select what to remove when maxmemory 75 | # is reached. You can select among five behaviors: 76 | # 77 | # volatile-lru -> Evict using approximated LRU among the keys with an expire set. 78 | # allkeys-lru -> Evict any key using approximated LRU. 79 | # volatile-lfu -> Evict using approximated LFU among the keys with an expire set. 80 | # allkeys-lfu -> Evict any key using approximated LFU. 81 | # volatile-random -> Remove a random key among the ones with an expire set. 82 | # allkeys-random -> Remove a random key, any key. 83 | # volatile-ttl -> Remove the key with the nearest expire time (minor TTL) 84 | # noeviction -> Don't evict anything, just return an error on write operations. 85 | # 86 | # LRU means Least Recently Used 87 | # LFU means Least Frequently Used 88 | # 89 | # Both LRU, LFU and volatile-ttl are implemented using approximated 90 | # randomized algorithms. 91 | # 92 | # Note: with any of the above policies, Redis will return an error on write 93 | # operations, when there are no suitable keys for eviction. 94 | # 95 | # At the date of writing these commands are: set setnx setex append 96 | # incr decr rpush lpush rpushx lpushx linsert lset rpoplpush sadd 97 | # sinter sinterstore sunion sunionstore sdiff sdiffstore zadd zincrby 98 | # zunionstore zinterstore hset hsetnx hmset hincrby incrby decrby 99 | # getset mset msetnx exec sort 100 | # 101 | # The default is: 102 | # 103 | maxmemory-policy allkeys-lru -------------------------------------------------------------------------------- /docker-compose.yml: -------------------------------------------------------------------------------- 1 | version: '3.7' 2 | 3 | x-default-variables: &default-variables 4 | CONTRACT_REGISTRY_URL: ${CONTRACT_REGISTRY_URL-contract-registry:8080} 5 | CHAIN_REGISTRY_URL: ${CHAIN_REGISTRY_URL-http://chain-registry:8081} 6 | TRANSACTION_SCHEDULER_URL: ${TRANSACTION_SCHEDULER_URL-http://transaction-scheduler:8081} 7 | KAFKA_URL: ${KAFKA_URL-kafka:29092} 8 | CHAIN_REGISTRY_INIT: ${CHAIN_REGISTRY_INIT-} 9 | ETH_CLIENT_RETRY_MAX_ELAPSED_TIME: 5s 10 | LOG_LEVEL: ${LOG_LEVEL-info} 11 | LOG_FORMAT: ${LOG_FORMAT-json} 12 | JAEGER_AGENT_HOST: ${JAEGER_AGENT_HOST-jaeger} 13 | JAEGER_AGENT_PORT: ${JAEGER_AGENT_PORT-6831} 14 | NONCE_MANAGER_TYPE: ${NONCE_MANAGER_TYPE-redis} 15 | REDIS_HOST: ${REDIS_HOST-redis} 16 | REDIS_PORT: ${REDIS_PORT-6379} 17 | VAULT_ADDR: ${VAULT_ADDR-http://vault:8200} 18 | MULTI_TENANCY_ENABLED: ${MULTI_TENANCY_ENABLED-} 19 | AUTH_JWT_CLAIMS_NAMESPACE: ${AUTH_JWT_CLAIMS_NAMESPACE-} 20 | AUTH_JWT_CERTIFICATE: ${AUTH_JWT_CERTIFICATE-} 21 | AUTH_JWT_PRIVATE_KEY: ${AUTH_JWT_PRIVATE_KEY-} 22 | AUTH_API_KEY: ${AUTH_API_KEY-} 23 | TX_SCHEDULER_ENABLED: ${TX_SCHEDULER_ENABLED-true} 24 | ENVELOPE_STORE_ENABLED: ${ENVELOPE_STORE_ENABLED-false} 25 | 26 | x-container-common: &container-common 27 | restart: ${CONTAINER_RESTART-on-failure} 28 | image: consensys-docker-pegasys-orchestrate.bintray.io/orchestrate:v2.5.3 29 | networks: 30 | - orchestrate 31 | 32 | x-contract-registry-common: &contract-registry-common 33 | CONTRACT_REGISTRY_TYPE: ${CONTRACT_REGISTRY_TYPE-} 34 | DB_HOST: postgres-contract-registry 35 | 36 | x-transaction-scheduler-common: &transaction-scheduler-common 37 | TRANSACTION_SCHEDULER_TYPE: ${TRANSACTION_SCHEDULER_TYPE-} 38 | DB_HOST: postgres-transaction-scheduler 39 | 40 | x-chain-registry-common: &chain-registry-common 41 | CHAIN_REGISTRY_TYPE: ${CHAIN_REGISTRY_TYPE-} 42 | DB_HOST: postgres-chain-registry 43 | 44 | services: 45 | chain-registry-migration-init: 46 | <<: *container-common 47 | environment: 48 | <<: *default-variables 49 | <<: *chain-registry-common 50 | restart: 'no' 51 | command: chain-registry migrate init 52 | 53 | chain-registry-migration: 54 | <<: *container-common 55 | environment: 56 | <<: *default-variables 57 | <<: *chain-registry-common 58 | restart: 'no' 59 | depends_on: 60 | - chain-registry-migration-init 61 | command: chain-registry migrate 62 | 63 | chain-registry: 64 | <<: *container-common 65 | ports: 66 | - 8010:8080 67 | - 8011:8081 68 | - 8012:8082 69 | environment: 70 | <<: *default-variables 71 | <<: *chain-registry-common 72 | CHAIN_REGISTRY_INIT: ${CHAIN_REGISTRY_INIT-} 73 | depends_on: 74 | - chain-registry-migration 75 | command: chain-registry run 76 | 77 | contract-registry-migration-init: 78 | <<: *container-common 79 | environment: 80 | <<: *default-variables 81 | <<: *contract-registry-common 82 | restart: 'no' 83 | command: contract-registry migrate init 84 | 85 | contract-registry-migration: 86 | <<: *container-common 87 | environment: 88 | <<: *default-variables 89 | <<: *contract-registry-common 90 | restart: 'no' 91 | depends_on: 92 | - contract-registry-migration-init 93 | command: contract-registry migrate 94 | 95 | contract-registry: 96 | <<: *container-common 97 | ports: 98 | - 8020:8080 99 | - 8021:8081 100 | - 8022:8082 101 | environment: 102 | <<: *default-variables 103 | <<: *contract-registry-common 104 | LOG_LEVEL: trace 105 | depends_on: 106 | - contract-registry-migration 107 | command: contract-registry run 108 | 109 | transaction-scheduler-migration-init: 110 | <<: *container-common 111 | environment: 112 | <<: *default-variables 113 | <<: *transaction-scheduler-common 114 | restart: 'no' 115 | command: transaction-scheduler migrate init 116 | 117 | transaction-scheduler-migration: 118 | <<: *container-common 119 | environment: 120 | <<: *default-variables 121 | <<: *transaction-scheduler-common 122 | restart: 'no' 123 | depends_on: 124 | - transaction-scheduler-migration-init 125 | command: transaction-scheduler migrate up 126 | 127 | transaction-scheduler: 128 | <<: *container-common 129 | ports: 130 | - 8030:8080 131 | - 8031:8081 132 | - 8032:8082 133 | environment: 134 | <<: *default-variables 135 | <<: *transaction-scheduler-common 136 | depends_on: 137 | - transaction-scheduler-migration 138 | command: transaction-scheduler run 139 | 140 | tx-crafter: 141 | <<: *container-common 142 | environment: 143 | <<: *default-variables 144 | JAEGER_SERVICE_NAME: TX-CRAFTER 145 | depends_on: 146 | - contract-registry 147 | command: tx-crafter run 148 | 149 | tx-signer: 150 | <<: *container-common 151 | environment: 152 | <<: *default-variables 153 | JAEGER_SERVICE_NAME: TX-SIGNER 154 | SECRET_PKEY: ${SECRET_PKEY-} 155 | SECRET_STORE: ${SECRET_STORE-hashicorp} 156 | volumes: 157 | - vault-token:/vault/token:ro 158 | command: tx-signer run 159 | 160 | tx-sender: 161 | <<: *container-common 162 | environment: 163 | <<: *default-variables 164 | JAEGER_SERVICE_NAME: TX-SENDER 165 | depends_on: 166 | - transaction-scheduler 167 | command: tx-sender run 168 | 169 | tx-listener: 170 | <<: *container-common 171 | environment: 172 | <<: *default-variables 173 | LISTENER_START_DEFAULT: latest 174 | JAEGER_SERVICE_NAME: TX-LISTENER 175 | depends_on: 176 | - transaction-scheduler 177 | - chain-registry 178 | command: tx-listener run 179 | 180 | generate-jwt: 181 | <<: *container-common 182 | environment: 183 | <<: *default-variables 184 | TENANT_ID: ${TENANT_ID-} 185 | command: 'utils generate-jwt --tenant=${TENANT_ID}' 186 | restart: 'no' 187 | 188 | volumes: 189 | vault-token: 190 | external: 191 | name: deps_vault-token 192 | 193 | networks: 194 | orchestrate: 195 | external: 196 | name: deps_orchestrate 197 | -------------------------------------------------------------------------------- /community-membership.md: -------------------------------------------------------------------------------- 1 | # Community membership 2 | 3 | This doc outlines the various responsibilities of contributor roles in 4 | this project. 5 | 6 | | Role | Responsibilities | Defined by | 7 | | ------------------- | -------------------------------------------- | --------------------------- | 8 | | Everyone | none | anybody with a belly button | 9 | | Member | everyone who contributes - code or otherwise | Orchestrate org member | 10 | | Approver | approve accepting contributions | write permissions on master | 11 | | Project Sponsor | contribute developer resources | PegaSys | 12 | | Project Evangelist | promote the project | PegaSys | 13 | | Benevolent Dictator | decision tie-breaker | PegaSys | 14 | 15 | ## Everyone 16 | 17 | Any person from the public is able to access the code. The standard permissions grant the ability to view the code, view open bugs, access the wiki, download binaries, view CI results and comment on pull requests. 18 | 19 | ## New contributors 20 | 21 | [New contributors] should be welcomed to the community by existing members, 22 | helped with PR workflow, and directed to relevant documentation and 23 | communication channels. 24 | 25 | ## Established community members 26 | 27 | Established community members are expected to demonstrate their adherence to the 28 | principles in this document, familiarity with project organization, roles, 29 | policies, procedures, conventions, etc., and technical and/or writing ability. 30 | Role-specific expectations, responsibilities, and requirements are enumerated 31 | below. 32 | 33 | ## Member 34 | 35 | Members are continuously active contributors in the community. They can have 36 | issues and PRs assigned to them. 37 | 38 | ### Requirements 39 | 40 | - Enabled [two-factor authentication] on their GitHub account 41 | - Have made multiple contributions to the project or community. Contribution may include, but is not limited to: 42 | - Authoring or reviewing PRs on GitHub 43 | - Filing or commenting on issues on GitHub 44 | - Contributing to community discussions (e.g. meetings, Slack, email discussion forums, Stack Overflow) 45 | - Have read the [contributor guide] 46 | - Signed ICLA, as described in [CLA.md] 47 | 48 | ### Responsibilities and privileges 49 | 50 | - Responsive to issues and PRs assigned to them 51 | - Active owner of code they have contributed (unless ownership is explicitly transferred) 52 | - Code is well tested 53 | - Tests consistently pass 54 | - Addresses bugs or issues discovered after code is accepted 55 | - Members can do `/lgtm` on open PRs 56 | - They can be assigned to issues and PRs, and people can ask members for reviews with a `/cc @username` 57 | 58 | ## Approver 59 | 60 | Code approvers are members that have signed an ICLA and have been granted additional commit privileges. While members are expected to provided code reviews that focus on code quality and correctness, approval is focused on holistic acceptance of a contribution including: backwards / forwards compatibility, adhering to API and flag conventions, subtle performance and correctness issues, interactions with other parts of the system, etc. 61 | 62 | **Defined by:** write permissions on master branch 63 | 64 | ### Requirements 65 | 66 | - Includes all of the requirements of a Member user 67 | - Signed ICLA, as described in [CLA.md] 68 | - Approver status granted by Project Sponsor or the Open Source Circle 69 | 70 | ### Responsibilities and privileges 71 | 72 | - Includes all of the responsibilities and privileges of a Member user 73 | - Approver status may be a precondition to accepting large code contributions 74 | - Demonstrate sound technical judgement 75 | - Responsible for project quality control via code reviews 76 | - Focus on holistic acceptance of contribution such as dependencies with other features, backwards / forwards 77 | compatibility, API and flag definitions, etc 78 | - Expected to be responsive to review requests as per [community expectations] 79 | - Mentor members 80 | - May approve pull requests 81 | - May merge pull requests 82 | 83 | ## Project Sponsor 84 | 85 | The Project Sponsor role provides a user with the ability to contribute additional developer resources to the project. Project Sponsors must sign the ICLA. 86 | 87 | **Defined by:** PegaSys 88 | 89 | ### Requirements 90 | 91 | - Signed ICLA, as described in [CLA.md] 92 | - Project Sponsor status granted by the Open Source Circle 93 | 94 | ### Responsibilities and privileges 95 | 96 | - Includes all of the responsibilities and privileges of a Member user 97 | - Approval of new users to the Approver role, and access to Circle reports. 98 | 99 | ## Project Evangelist 100 | 101 | The Project Evangelist role is for those who wish to promote the project to the outside world, but not actively contribute to it. 102 | **Defined by:** PegaSys 103 | 104 | ### Requirements 105 | 106 | - Includes all of the requirements of a Member user 107 | - Signed ICLA, as described in [CLA.md] 108 | - Project Evangelist status granted by the Open Source Circle 109 | 110 | ### Responsibilities and privileges 111 | 112 | - Includes all of the responsibilities and privileges of a Member user 113 | - Project Evangelist have the standard public access permissions 114 | - Organise talks 115 | - Work with marketing to manage web and graphical assets 116 | 117 | ## Benevolent Dictator 118 | 119 | The benevolent dictator, or project lead, is self-appointed. However, because the community always has the ability to fork, this person is fully answerable to the community. The key is to ensure that, as the project expands, the right people are given influence over it and the community rallies behind the vision of the project lead. 120 | 121 | ### Responsibilities and privileges 122 | 123 | - Set the strategic objectives of the project and communicate these clearly to the community 124 | - Understand the community as a whole and strive to satisfy as many conflicting needs as possible, while ensuring that the project survives in the long term 125 | - Ensure that the approvers make the right decisions on behalf of the project 126 | - Provide final tie-breaker decisions when consensus cannot be reached. 127 | 128 | ## Attribution 129 | 130 | This document is adapted from the following sources: 131 | 132 | - Kubernetes community-membership.md, available at [kub community membership]. 133 | - OSSWatch Benevolent Dictator Governance Model, available at [oss watch benevolent dictator]. 134 | 135 | [cla.md]: /CLA.md 136 | [oss watch benevolent dictator]: http://oss-watch.ac.uk/resources/benevolentdictatorgovernancemodel 137 | [kub community membership]: https://raw.githubusercontent.com/kubernetes/community/master/community-membership.md 138 | [contributor guide]: /CONTRIBUTING.md 139 | [new contributors]: /CONTRIBUTING.md 140 | [two-factor authentication]: https://help.github.com/articles/about-two-factor-authentication 141 | -------------------------------------------------------------------------------- /CONTRIBUTING.md: -------------------------------------------------------------------------------- 1 | # Contributing to Orchestrate 2 | 3 | :+1::tada: First off, thanks for taking the time to contribute! :tada::+1: 4 | 5 | Welcome to the Orchestrate repositories! The following is a set of guidelines for contributing to this repo and its packages. These are mostly guidelines, not rules. Use your best judgment, and feel free to propose changes to this document in a pull request. 6 | 7 | #### Table Of Contents 8 | 9 | [Code of Conduct](#code-of-conduct) 10 | 11 | [I just have a quick question](#i-just-have-a-quick-question) 12 | 13 | [How to contribute](#how-to-contribute) 14 | 15 | - [Your first code contribution](#your-first-code-contribution) 16 | - [Reporting bugs](#reporting-bugs) 17 | 18 | [Style Guides](#style-guides) 19 | 20 | - [Node Style Guide](#node-code-style-guide) 21 | - [Git Commit Messages & Pull Request Messages](#git-commit-messages--pull-request-messages) 22 | 23 | ## Code of Conduct 24 | 25 | This project and everyone participating in it is governed by the [Orchestrate Code of Conduct](CODE-OF-CONDUCT.md). By participating, you are expected to uphold this code. Please report unacceptable behavior to [private@pegasys.tech]. 26 | 27 | ## I just have a quick question 28 | 29 | Send us an email at [support@pegasys.tech] and that's the fastest way to get an answer. 30 | 31 | ## How To Contribute 32 | 33 | ### Your first code contribution 34 | 35 | Start by looking through the 'good first issue' and 'help wanted' issues: 36 | 37 | - [Good First Issue][search-label-good-first-issue] - issues which should only require a few lines of code, and a test or two. 38 | - [Help wanted issues][search-label-help-wanted] - issues which are a bit more involved than `good first issue` issues. 39 | 40 | ### Local Development 41 | 42 | The codebase is maintained using the "_contributor workflow_" where everyone without exception contributes patch proposals using "_pull-requests_". This facilitates social contribution, easy testing and peer review. 43 | 44 | To contribute a patch, the workflow is as follows: 45 | 46 | - Fork repository 47 | - Create topic branch 48 | - Commit patch 49 | - Create pull-request, adhering to the coding conventions herein set forth 50 | 51 | In general a commit serves a single purpose and diffs should be easily comprehensible. For this reason do not mix any formatting fixes or code moves with actual code changes. 52 | 53 | ### Automated Test coverage 54 | 55 | All code submissions must be accompanied by appropriate automated tests. The goal is to provide confidence in the code’s robustness, while avoiding redundant tests. 56 | 57 | ### Pull Requests 58 | 59 | The process described here has several goals: 60 | 61 | - Maintain Product quality 62 | - Fix problems that are important to users 63 | - Engage the community in working toward the best possible product 64 | - Enable a sustainable system for maintainers to review contributions 65 | - Further explanation on PR & commit messages can be found in this post: [How to Write a Git Commit Message](https://chris.beams.io/posts/git-commit/). 66 | 67 | Please follow these steps to have your contribution considered by the approvers: 68 | 69 | 1. Complete the CLA, as described in [CLA.md] 70 | 2. Follow all instructions in [PULL-REQUEST-TEMPLATE.md](.github/pull_request_template.md) 71 | 3. Include appropriate test coverage. Testing is 100% automated. There is no such thing as a manual test. 72 | 4. Follow the [Style Guides](#style-guides) 73 | 5. After you submit your pull request, verify that all [status checks](https://help.github.com/articles/about-status-checks/) are passing
What if the status checks are failing?If a status check is failing, and you believe that the failure is unrelated to your change, please leave a comment on the pull request explaining why you believe the failure is unrelated. A maintainer will re-run the status check for you. If we conclude that the failure was a false positive, then we will open an issue to track that problem with our status check suite.
74 | 75 | While the prerequisites above must be satisfied prior to having your pull request reviewed, the reviewer(s) may ask you to complete additional design work, tests, or other changes before your pull request can be ultimately accepted. Please refer to [Code Reviews]. 76 | 77 | ## Reporting Bugs 78 | 79 | Following these guidelines helps maintainers and the community understand your report, reproduce the behavior, and find related reports. 80 | 81 | Explain the problem and include additional details to help maintainers reproduce the problem: 82 | 83 | - **Use a clear and descriptive title** for the issue to identify the problem. 84 | - **Describe the exact steps which reproduce the problem** in as many details as possible. For example, start by explaining how you started Orchestrate, e.g. which command exactly you used in the terminal, or how you started it otherwise. 85 | - **Provide specific examples to demonstrate the steps**. Include links to files or GitHub projects, or copy/pasteable snippets, which you use in those examples. If you're providing snippets in the issue, use [Markdown code blocks](https://help.github.com/articles/markdown-basics/#multiple-lines). 86 | - **Describe the behavior you observed after following the steps** and point out what exactly is the problem with that behavior. 87 | - **Explain which behavior you expected to see instead and why.** 88 | - **Include screenshots** which show you following the described steps and clearly demonstrate the problem. 89 | 90 | Provide more context by answering these questions: 91 | 92 | - **Did the problem start happening recently** (e.g. after updating to a new version of the software) or was this always a problem? 93 | - If the problem started happening recently, **can you reproduce the problem in an older version of the software?** What's the most recent version in which the problem doesn't happen? 94 | - **Can you reliably reproduce the issue?** If not, provide details about how often the problem happens and under which conditions it normally happens. 95 | 96 | Include details about your configuration and environment: 97 | 98 | - **Which version of the software are you using?** You can get the exact version by running `npm list pegasys-orchestrate` in your terminal. 99 | - **What OS & Version are you running?** 100 | - **For Linux - What kernel are you running?** You can get the exact version by running `uname -a` in your terminal. 101 | - **Are you running in a virtual machine?** If so, which VM software are you using and which operating systems and versions are used for the host and the guest? 102 | - **Are you running in a docker container?** If so, what version of docker? 103 | - **Are you running in a a Cloud?** If so, which one, and what type/size of VM is it? 104 | 105 | # Style Guides 106 | 107 | ## Node Code Style Guide 108 | 109 | To reformat code, run: 110 | 111 | ``` 112 | npm run lint 113 | npm run format 114 | ``` 115 | 116 | Code style will be checked automatically during a build. 117 | 118 | ## Git Commit Messages & Pull Request Messages 119 | 120 | - Use the present tense ("Add feature" not "Added feature") 121 | - Use the imperative mood ("Move cursor to..." not "Moves cursor to...") 122 | - Provide a summary on the first line with more details on additional lines as needed 123 | - Reference issues and pull requests liberally 124 | 125 | [private@pegasys.tech]: mailto:private@pegasys.tech 126 | [cla.md]: /CLA.md 127 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Apache License 2 | Version 2.0, January 2004 3 | http://www.apache.org/licenses/ 4 | 5 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 6 | 7 | 1. Definitions. 8 | 9 | "License" shall mean the terms and conditions for use, reproduction, 10 | and distribution as defined by Sections 1 through 9 of this document. 11 | 12 | "Licensor" shall mean the copyright owner or entity authorized by 13 | the copyright owner that is granting the License. 14 | 15 | "Legal Entity" shall mean the union of the acting entity and all 16 | other entities that control, are controlled by, or are under common 17 | control with that entity. For the purposes of this definition, 18 | "control" means (i) the power, direct or indirect, to cause the 19 | direction or management of such entity, whether by contract or 20 | otherwise, or (ii) ownership of fifty percent (50%) or more of the 21 | outstanding shares, or (iii) beneficial ownership of such entity. 22 | 23 | "You" (or "Your") shall mean an individual or Legal Entity 24 | exercising permissions granted by this License. 25 | 26 | "Source" form shall mean the preferred form for making modifications, 27 | including but not limited to software source code, documentation 28 | source, and configuration files. 29 | 30 | "Object" form shall mean any form resulting from mechanical 31 | transformation or translation of a Source form, including but 32 | not limited to compiled object code, generated documentation, 33 | and conversions to other media types. 34 | 35 | "Work" shall mean the work of authorship, whether in Source or 36 | Object form, made available under the License, as indicated by a 37 | copyright notice that is included in or attached to the work 38 | (an example is provided in the Appendix below). 39 | 40 | "Derivative Works" shall mean any work, whether in Source or Object 41 | form, that is based on (or derived from) the Work and for which the 42 | editorial revisions, annotations, elaborations, or other modifications 43 | represent, as a whole, an original work of authorship. For the purposes 44 | of this License, Derivative Works shall not include works that remain 45 | separable from, or merely link (or bind by name) to the interfaces of, 46 | the Work and Derivative Works thereof. 47 | 48 | "Contribution" shall mean any work of authorship, including 49 | the original version of the Work and any modifications or additions 50 | to that Work or Derivative Works thereof, that is intentionally 51 | submitted to Licensor for inclusion in the Work by the copyright owner 52 | or by an individual or Legal Entity authorized to submit on behalf of 53 | the copyright owner. For the purposes of this definition, "submitted" 54 | means any form of electronic, verbal, or written communication sent 55 | to the Licensor or its representatives, including but not limited to 56 | communication on electronic mailing lists, source code control systems, 57 | and issue tracking systems that are managed by, or on behalf of, the 58 | Licensor for the purpose of discussing and improving the Work, but 59 | excluding communication that is conspicuously marked or otherwise 60 | designated in writing by the copyright owner as "Not a Contribution." 61 | 62 | "Contributor" shall mean Licensor and any individual or Legal Entity 63 | on behalf of whom a Contribution has been received by Licensor and 64 | subsequently incorporated within the Work. 65 | 66 | 2. Grant of Copyright License. Subject to the terms and conditions of 67 | this License, each Contributor hereby grants to You a perpetual, 68 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 69 | copyright license to reproduce, prepare Derivative Works of, 70 | publicly display, publicly perform, sublicense, and distribute the 71 | Work and such Derivative Works in Source or Object form. 72 | 73 | 3. Grant of Patent License. Subject to the terms and conditions of 74 | this License, each Contributor hereby grants to You a perpetual, 75 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 76 | (except as stated in this section) patent license to make, have made, 77 | use, offer to sell, sell, import, and otherwise transfer the Work, 78 | where such license applies only to those patent claims licensable 79 | by such Contributor that are necessarily infringed by their 80 | Contribution(s) alone or by combination of their Contribution(s) 81 | with the Work to which such Contribution(s) was submitted. If You 82 | institute patent litigation against any entity (including a 83 | cross-claim or counterclaim in a lawsuit) alleging that the Work 84 | or a Contribution incorporated within the Work constitutes direct 85 | or contributory patent infringement, then any patent licenses 86 | granted to You under this License for that Work shall terminate 87 | as of the date such litigation is filed. 88 | 89 | 4. Redistribution. You may reproduce and distribute copies of the 90 | Work or Derivative Works thereof in any medium, with or without 91 | modifications, and in Source or Object form, provided that You 92 | meet the following conditions: 93 | 94 | (a) You must give any other recipients of the Work or 95 | Derivative Works a copy of this License; and 96 | 97 | (b) You must cause any modified files to carry prominent notices 98 | stating that You changed the files; and 99 | 100 | (c) You must retain, in the Source form of any Derivative Works 101 | that You distribute, all copyright, patent, trademark, and 102 | attribution notices from the Source form of the Work, 103 | excluding those notices that do not pertain to any part of 104 | the Derivative Works; and 105 | 106 | (d) If the Work includes a "NOTICE" text file as part of its 107 | distribution, then any Derivative Works that You distribute must 108 | include a readable copy of the attribution notices contained 109 | within such NOTICE file, excluding those notices that do not 110 | pertain to any part of the Derivative Works, in at least one 111 | of the following places: within a NOTICE text file distributed 112 | as part of the Derivative Works; within the Source form or 113 | documentation, if provided along with the Derivative Works; or, 114 | within a display generated by the Derivative Works, if and 115 | wherever such third-party notices normally appear. The contents 116 | of the NOTICE file are for informational purposes only and 117 | do not modify the License. You may add Your own attribution 118 | notices within Derivative Works that You distribute, alongside 119 | or as an addendum to the NOTICE text from the Work, provided 120 | that such additional attribution notices cannot be construed 121 | as modifying the License. 122 | 123 | You may add Your own copyright statement to Your modifications and 124 | may provide additional or different license terms and conditions 125 | for use, reproduction, or distribution of Your modifications, or 126 | for any such Derivative Works as a whole, provided Your use, 127 | reproduction, and distribution of the Work otherwise complies with 128 | the conditions stated in this License. 129 | 130 | 5. Submission of Contributions. Unless You explicitly state otherwise, 131 | any Contribution intentionally submitted for inclusion in the Work 132 | by You to the Licensor shall be under the terms and conditions of 133 | this License, without any additional terms or conditions. 134 | Notwithstanding the above, nothing herein shall supersede or modify 135 | the terms of any separate license agreement you may have executed 136 | with Licensor regarding such Contributions. 137 | 138 | 6. Trademarks. This License does not grant permission to use the trade 139 | names, trademarks, service marks, or product names of the Licensor, 140 | except as required for reasonable and customary use in describing the 141 | origin of the Work and reproducing the content of the NOTICE file. 142 | 143 | 7. Disclaimer of Warranty. Unless required by applicable law or 144 | agreed to in writing, Licensor provides the Work (and each 145 | Contributor provides its Contributions) on an "AS IS" BASIS, 146 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 147 | implied, including, without limitation, any warranties or conditions 148 | of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A 149 | PARTICULAR PURPOSE. You are solely responsible for determining the 150 | appropriateness of using or redistributing the Work and assume any 151 | risks associated with Your exercise of permissions under this License. 152 | 153 | 8. Limitation of Liability. In no event and under no legal theory, 154 | whether in tort (including negligence), contract, or otherwise, 155 | unless required by applicable law (such as deliberate and grossly 156 | negligent acts) or agreed to in writing, shall any Contributor be 157 | liable to You for damages, including any direct, indirect, special, 158 | incidental, or consequential damages of any character arising as a 159 | result of this License or out of the use or inability to use the 160 | Work (including but not limited to damages for loss of goodwill, 161 | work stoppage, computer failure or malfunction, or any and all 162 | other commercial damages or losses), even if such Contributor 163 | has been advised of the possibility of such damages. 164 | 165 | 9. Accepting Warranty or Additional Liability. While redistributing 166 | the Work or Derivative Works thereof, You may choose to offer, 167 | and charge a fee for, acceptance of support, warranty, indemnity, 168 | or other liability obligations and/or rights consistent with this 169 | License. However, in accepting such obligations, You may act only 170 | on Your own behalf and on Your sole responsibility, not on behalf 171 | of any other Contributor, and only if You agree to indemnify, 172 | defend, and hold each Contributor harmless for any liability 173 | incurred by, or claims asserted against, such Contributor by reason 174 | of your accepting any such warranty or additional liability. 175 | 176 | END OF TERMS AND CONDITIONS 177 | 178 | APPENDIX: How to apply the Apache License to your work. 179 | 180 | To apply the Apache License to your work, attach the following 181 | boilerplate notice, with the fields enclosed by brackets "{}" 182 | replaced with your own identifying information. (Don't include 183 | the brackets!) The text should be enclosed in the appropriate 184 | comment syntax for the file format. We also recommend that a 185 | file or class name and description of purpose be included on the 186 | same "printed page" as the copyright notice for easier 187 | identification within third-party archives. 188 | 189 | Copyright {yyyy} {name of copyright owner} 190 | 191 | Licensed under the Apache License, Version 2.0 (the "License"); 192 | you may not use this file except in compliance with the License. 193 | You may obtain a copy of the License at 194 | 195 | http://www.apache.org/licenses/LICENSE-2.0 196 | 197 | Unless required by applicable law or agreed to in writing, software 198 | distributed under the License is distributed on an "AS IS" BASIS, 199 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 200 | See the License for the specific language governing permissions and 201 | limitations under the License. -------------------------------------------------------------------------------- /scripts/besu/config/genesis.json: -------------------------------------------------------------------------------- 1 | { 2 | "config": { 3 | "chainId": 2020, 4 | "constantinoplefixblock": 0, 5 | "ibft2": { 6 | "blockperiodseconds": 2, 7 | "epochlength": 30000, 8 | "requesttimeoutseconds": 10 9 | } 10 | }, 11 | "nonce": "0x0", 12 | "timestamp": "0x58ee40ba", 13 | "gasLimit": "0x1fffffffffffff", 14 | "difficulty": "0x1", 15 | "mixHash": "0x63746963616c2062797a616e74696e65206661756c7420746f6c6572616e6365", 16 | "extraData": "0xf869a00000000000000000000000000000000000000000000000000000000000000000f83f949c2106cca920c09cfeca24d4dd5323f0a97ba00c94a46f0935de4176ffeccdeecaf3c6e3ca03e31b2294866b0df7138daf807300ed9204de733c1eb6d600808400000000c0", 17 | "coinbase": "0x0000000000000000000000000000000000000000", 18 | "alloc": { 19 | "fe3b557e8fb62b89f4916b721be55ceb828dbd73": { 20 | "privateKey": "8f2a55949038a9610f50fb23b5883af3b4ecb3c3bb792cbcefbd1542c692be63", 21 | "comment": "private key and this comment are ignored. In a real chain, the private key should NOT be stored", 22 | "balance": "0xad78ebc5ac6200000" 23 | }, 24 | "627306090abaB3A6e1400e9345bC60c78a8BEf57": { 25 | "privateKey": "c87509a1c067bbde78beb793e6fa76530b6382a4c0241e5e4a9ec0a0f44dc0d3", 26 | "comment": "private key and this comment are ignored. In a real chain, the private key should NOT be stored", 27 | "balance": "90000000000000000000000" 28 | }, 29 | "f17f52151EbEF6C7334FAD080c5704D77216b732": { 30 | "privateKey": "ae6ae8e5ccbfb04590405997ee2d52d2b330726137b875053c36d94e974d162f", 31 | "comment": "private key and this comment are ignored. In a real chain, the private key should NOT be stored", 32 | "balance": "90000000000000000000000" 33 | }, 34 | "0x0000000000000000000000000000000000008888": { 35 | "comment": "Ingress smart contract for Account Permissioning", 36 | "balance": "0", 37 | "code": "608060405234801561001057600080fd5b506004361061009e5760003560e01c8063936421d511610066578063936421d5146101ca578063a43e04d8146102fb578063de8fa43114610341578063e001f8411461035f578063fe9fbb80146103c55761009e565b80630d2020dd146100a357806310d9042e1461011157806311601306146101705780631e7c27cb1461018e5780638aa10435146101ac575b600080fd5b6100cf600480360360208110156100b957600080fd5b8101908080359060200190929190505050610421565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b6101196104d6565b6040518080602001828103825283818151815260200191508051906020019060200280838360005b8381101561015c578082015181840152602081019050610141565b505050509050019250505060405180910390f35b61017861052e565b6040518082815260200191505060405180910390f35b610196610534565b6040518082815260200191505060405180910390f35b6101b461053a565b6040518082815260200191505060405180910390f35b6102e1600480360360c08110156101e057600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff1690602001909291908035906020019092919080359060200190929190803590602001909291908035906020019064010000000081111561025b57600080fd5b82018360208201111561026d57600080fd5b8035906020019184600183028401116401000000008311171561028f57600080fd5b91908080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f820116905080830192505050505050509192919290505050610544565b604051808215151515815260200191505060405180910390f35b6103276004803603602081101561031157600080fd5b810190808035906020019092919050505061073f565b604051808215151515815260200191505060405180910390f35b610349610a1e565b6040518082815260200191505060405180910390f35b6103ab6004803603604081101561037557600080fd5b8101908080359060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610a2b565b604051808215151515815260200191505060405180910390f35b610407600480360360208110156103db57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610caf565b604051808215151515815260200191505060405180910390f35b60008060001b821161049b576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f436f6e7472616374206e616d65206d757374206e6f7420626520656d7074792e81525060200191505060405180910390fd5b6002600083815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff169050919050565b6060600380548060200260200160405190810160405280929190818152602001828054801561052457602002820191906000526020600020905b815481526020019060010190808311610510575b5050505050905090565b60005481565b60015481565b6000600554905090565b60008073ffffffffffffffffffffffffffffffffffffffff16610568600054610421565b73ffffffffffffffffffffffffffffffffffffffff16141561058d5760019050610735565b600260008054815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663936421d58888888888886040518763ffffffff1660e01b8152600401808773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200185815260200184815260200183815260200180602001828103825283818151815260200191508051906020019080838360005b838110156106a857808201518184015260208101905061068d565b50505050905090810190601f1680156106d55780820380516001836020036101000a031916815260200191505b5097505050505050505060206040518083038186803b1580156106f757600080fd5b505afa15801561070b573d6000803e3d6000fd5b505050506040513d602081101561072157600080fd5b810190808051906020019092919050505090505b9695505050505050565b60008060001b82116107b9576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f436f6e7472616374206e616d65206d757374206e6f7420626520656d7074792e81525060200191505060405180910390fd5b600060038054905011610817576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526047815260200180610e446047913960600191505060405180910390fd5b61082033610caf565b610875576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252602b815260200180610e19602b913960400191505060405180910390fd5b6000600460008481526020019081526020016000205490506000811180156108a257506003805490508111155b15610a135760038054905081146109105760006003600160038054905003815481106108ca57fe5b9060005260206000200154905080600360018403815481106108e857fe5b9060005260206000200181905550816004600083815260200190815260200160002081905550505b600380548061091b57fe5b600190038181906000526020600020016000905590556000600460008581526020019081526020016000208190555060006002600085815260200190815260200160002060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055507fe3d908a1f6d2467f8e7c8198f30125843211345eedb763beb4cdfb7fe728a5af600084604051808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018281526020019250505060405180910390a16001915050610a19565b60009150505b919050565b6000600380549050905090565b60008060001b8311610aa5576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f436f6e7472616374206e616d65206d757374206e6f7420626520656d7074792e81525060200191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415610b2b576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526022815260200180610e8b6022913960400191505060405180910390fd5b610b3433610caf565b610b89576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252602b815260200180610e19602b913960400191505060405180910390fd5b600060046000858152602001908152602001600020541415610be8576003839080600181540180825580915050906001820390600052602060002001600090919290919091505560046000858152602001908152602001600020819055505b816002600085815260200190815260200160002060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055507fe3d908a1f6d2467f8e7c8198f30125843211345eedb763beb4cdfb7fe728a5af8284604051808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018281526020019250505060405180910390a16001905092915050565b60008073ffffffffffffffffffffffffffffffffffffffff1660026000600154815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161415610d235760019050610e13565b60026000600154815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663fe9fbb80836040518263ffffffff1660e01b8152600401808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060206040518083038186803b158015610dd557600080fd5b505afa158015610de9573d6000803e3d6000fd5b505050506040513d6020811015610dff57600080fd5b810190808051906020019092919050505090505b91905056fe4e6f7420617574686f72697a656420746f2075706461746520636f6e74726163742072656769737472792e4d7573742068617665206174206c65617374206f6e65207265676973746572656420636f6e747261637420746f20657865637574652064656c657465206f7065726174696f6e2e436f6e74726163742061646472657373206d757374206e6f74206265207a65726f2ea265627a7a723058207ca1249f31658f67f2a2383d4b63a0499b1efa44c3c2c60d73b2bdd96c412a5d64736f6c63430005090032", 38 | "storage": { 39 | "0x0000000000000000000000000000000000000000000000000000000000000000": "0x72756c6573000000000000000000000000000000000000000000000000000000", 40 | "0x0000000000000000000000000000000000000000000000000000000000000001": "0x61646d696e697374726174696f6e000000000000000000000000000000000000", 41 | "0x0000000000000000000000000000000000000000000000000000000000000004": "0x0f4240" 42 | } 43 | }, 44 | "0x0000000000000000000000000000000000009999": { 45 | "comment": "Ingress smart contract for Node Permissioning", 46 | "balance": "0", 47 | "code": "608060405234801561001057600080fd5b50600436106100a95760003560e01c80634dc3fefc116100715780634dc3fefc1461026e5780638aa104351461029e578063a43e04d8146102bc578063de8fa43114610302578063e001f84114610320578063fe9fbb8014610386576100a9565b80630d2020dd146100ae57806310d9042e1461011c578063116013061461017b5780631e7c27cb146101995780633620b1df146101b7575b600080fd5b6100da600480360360208110156100c457600080fd5b81019080803590602001909291905050506103e2565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b610124610497565b6040518080602001828103825283818151815260200191508051906020019060200280838360005b8381101561016757808201518184015260208101905061014c565b505050509050019250505060405180910390f35b6101836104ef565b6040518082815260200191505060405180910390f35b6101a16104f5565b6040518082815260200191505060405180910390f35b61025860048036036101008110156101ce57600080fd5b81019080803590602001909291908035906020019092919080356fffffffffffffffffffffffffffffffff19169060200190929190803561ffff169060200190929190803590602001909291908035906020019092919080356fffffffffffffffffffffffffffffffff19169060200190929190803561ffff1690602001909291905050506104fb565b6040518082815260200191505060405180910390f35b61029c6004803603602081101561028457600080fd5b810190808035151590602001909291905050506106c9565b005b6102a66107bf565b6040518082815260200191505060405180910390f35b6102e8600480360360208110156102d257600080fd5b81019080803590602001909291905050506107c9565b604051808215151515815260200191505060405180910390f35b61030a610aa8565b6040518082815260200191505060405180910390f35b61036c6004803603604081101561033657600080fd5b8101908080359060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610ab5565b604051808215151515815260200191505060405180910390f35b6103c86004803603602081101561039c57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610d39565b604051808215151515815260200191505060405180910390f35b60008060001b821161045c576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f436f6e7472616374206e616d65206d757374206e6f7420626520656d7074792e81525060200191505060405180910390fd5b6002600083815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff169050919050565b606060038054806020026020016040519081016040528092919081815260200182805480156104e557602002820191906000526020600020905b8154815260200190600101908083116104d1575b5050505050905090565b60005481565b60015481565b60008073ffffffffffffffffffffffffffffffffffffffff1661051f6000546103e2565b73ffffffffffffffffffffffffffffffffffffffff161415610566577f7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff60001b90506106bd565b600260008054815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16633620b1df8a8a8a8a8a8a8a8a6040518963ffffffff1660e01b815260040180898152602001888152602001876fffffffffffffffffffffffffffffffff19166fffffffffffffffffffffffffffffffff191681526020018661ffff1661ffff168152602001858152602001848152602001836fffffffffffffffffffffffffffffffff19166fffffffffffffffffffffffffffffffff191681526020018261ffff1661ffff1681526020019850505050505050505060206040518083038186803b15801561067f57600080fd5b505afa158015610693573d6000803e3d6000fd5b505050506040513d60208110156106a957600080fd5b810190808051906020019092919050505090505b98975050505050505050565b3373ffffffffffffffffffffffffffffffffffffffff16600260008054815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610781576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526033815260200180610ea36033913960400191505060405180910390fd5b7f66120f934b66d52127e448f8e94c2460ea62821335e0dd18e89ed38a4a09b41381604051808215151515815260200191505060405180910390a150565b6000600554905090565b60008060001b8211610843576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f436f6e7472616374206e616d65206d757374206e6f7420626520656d7074792e81525060200191505060405180910390fd5b6000600380549050116108a1576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526047815260200180610f016047913960600191505060405180910390fd5b6108aa33610d39565b6108ff576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252602b815260200180610ed6602b913960400191505060405180910390fd5b60006004600084815260200190815260200160002054905060008111801561092c57506003805490508111155b15610a9d57600380549050811461099a57600060036001600380549050038154811061095457fe5b90600052602060002001549050806003600184038154811061097257fe5b9060005260206000200181905550816004600083815260200190815260200160002081905550505b60038054806109a557fe5b600190038181906000526020600020016000905590556000600460008581526020019081526020016000208190555060006002600085815260200190815260200160002060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055507fe3d908a1f6d2467f8e7c8198f30125843211345eedb763beb4cdfb7fe728a5af600084604051808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018281526020019250505060405180910390a16001915050610aa3565b60009150505b919050565b6000600380549050905090565b60008060001b8311610b2f576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f436f6e7472616374206e616d65206d757374206e6f7420626520656d7074792e81525060200191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415610bb5576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526022815260200180610f486022913960400191505060405180910390fd5b610bbe33610d39565b610c13576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252602b815260200180610ed6602b913960400191505060405180910390fd5b600060046000858152602001908152602001600020541415610c72576003839080600181540180825580915050906001820390600052602060002001600090919290919091505560046000858152602001908152602001600020819055505b816002600085815260200190815260200160002060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055507fe3d908a1f6d2467f8e7c8198f30125843211345eedb763beb4cdfb7fe728a5af8284604051808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018281526020019250505060405180910390a16001905092915050565b60008073ffffffffffffffffffffffffffffffffffffffff1660026000600154815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161415610dad5760019050610e9d565b60026000600154815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663fe9fbb80836040518263ffffffff1660e01b8152600401808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060206040518083038186803b158015610e5f57600080fd5b505afa158015610e73573d6000803e3d6000fd5b505050506040513d6020811015610e8957600080fd5b810190808051906020019092919050505090505b91905056fe4f6e6c792052756c657320636f6e74726163742063616e20747269676765722052756c6573206368616e6765206576656e74734e6f7420617574686f72697a656420746f2075706461746520636f6e74726163742072656769737472792e4d7573742068617665206174206c65617374206f6e65207265676973746572656420636f6e747261637420746f20657865637574652064656c657465206f7065726174696f6e2e436f6e74726163742061646472657373206d757374206e6f74206265207a65726f2ea265627a7a723058208b95d097fa0ed2c9b86e5e60d93e89decddcde79ad22475fc542784d78e99aa164736f6c63430005090032", 48 | "storage": { 49 | "0x0000000000000000000000000000000000000000000000000000000000000000": "0x72756c6573000000000000000000000000000000000000000000000000000000", 50 | "0x0000000000000000000000000000000000000000000000000000000000000001": "0x61646d696e697374726174696f6e000000000000000000000000000000000000", 51 | "0x0000000000000000000000000000000000000000000000000000000000000004": "0x0f4240" 52 | } 53 | } 54 | } 55 | } 56 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | ### :exclamation: DEPRECATED :exclamation: 2 | 3 | This repository is **no longer maintained**. 4 | 5 | Active at [**quorum-dev-quickstart**](https://github.com/ConsenSys/quorum-dev-quickstart) 6 | 7 | # Codefi Orchestrate Quickstart 8 | 9 | [Orchestrate](https://codefi.consensys.net) is a platform that enables enterprises to easily build secure 10 | and reliable applications on Ethereum blockchains. 11 | 12 | > **Important:** The Orchestrate Quickstart is only available for Orchestrate customers and 13 | > [ConsenSys partners](https://consensys.net/solutions/partnerships/). 14 | > 15 | > [Contact ConsenSys](https://codefi.consensys.net/orchestrate-get-in-touch) if you want to purchase Orchestrate 16 | > or are interested in our [partner program](https://consensys.net/solutions/partnerships/). 17 | > 18 | > If you are already a partner or customer but we did not provide the credentials to access the 19 | > Docker registry, send an email from your company email to [orchestrate@consensys.net](mailto:orchestrate@consensys.net). 20 | > 21 | > You can use this Quickstart only if you have received these credentials from ConsenSys to connect to the registry. 22 | > 23 | > **You cannot continue this Quickstart without the registry credentials.** 24 | 25 | > **Tip** Try a free trial of Orchestrate with the [Quorum Dev Quickstart](https://github.com/PegaSysEng/quorum-dev-quickstart/tree/master/files/orchestrate). 26 | 27 | Orchestrate provides advanced features when connected to blockchain networks: 28 | 29 | - Transaction management (transaction crafting, gas management, nonce management, and transaction listening) 30 | - Account management with private key storage in Hashicorp Vault 31 | - Smart contract registry 32 | - Public and private transactions 33 | - Multi-chain. 34 | 35 | For more information, refer to the [Orchestrate documentation](https://docs.orchestrate.consensys.net/). 36 | 37 | During this quick-start you use: 38 | 39 | - Orchestrate command line interface using npm scripts. 40 | - Orchestrate REST API using Curl. 41 | - Orchestrate SDK using Node Javascript samples. 42 | 43 | ## Requirements 44 | 45 | - Run this Quickstart on a Linux or macOS machine. 46 | - Have access to the [Orchestrate Docker registry](#login-on-docker-registry). 47 | - [Docker version >= 18](https://www.docker.com/) installed and running and [Docker-compose](https://docs.docker.com/compose/install/) installed. 48 | - [Node.js version >=10 and NPM](https://nodejs.org/en/) installed. 49 | - [Curl](https://curl.haxx.se/download.html) installed. 50 | 51 | > **Tip:** _To avoid port conflicts, stop other Ethereum clients on your computer before starting 52 | > this quickstart._ 53 | 54 | ### Network requirement 55 | 56 | The quickstart connects to a blockchain network. You can use the default local Hyperledger Besu network 57 | provided by this quickstart or provide an external one, such as an Infura project. 58 | 59 | #### Local Besu network 60 | 61 | A local Besu network using Clique is included in this quickstart. 62 | If using the local Besu network, there are no specific requirements to run this network. 63 | 64 | #### External network 65 | 66 | To use an external network, you must have the network RPC endpoint address. 67 | 68 | You can use Infura with an [infura.io](https://infura.io/) account and a Rinkeby project ID. 69 | For more details, refer to [_Getting Started With Infura_](https://blog.infura.io/getting-started-with-infura-28e41844cc89/). 70 | 71 | ## Set up and run Orchestrate 72 | 73 | ### Clone project 74 | 75 | ```bash 76 | git clone https://github.com/PegaSysEng/orchestrate-quick-start.git 77 | ``` 78 | 79 | ### Install project dependencies 80 | 81 | ```bash 82 | npm install 83 | ``` 84 | 85 | ### Login on Docker registry 86 | 87 | If you are running Orchestrate for the first time, you must login to the Orchestrate Docker registry using the credentials that you received as a partner or customer. 88 | 89 | ```bash 90 | docker login -u -p consensys-docker-pegasys-orchestrate.bintray.io 91 | ``` 92 | 93 | ### Initialize Orchestrate services 94 | 95 | The Orchestrate Quickstart uses a Docker compose setup and includes Orchestrate services, as well as other services including Kafka, Redis, Postgres and Hashicorp Vault, and an Hyperledger Besu node. 96 | 97 | - Orchestrate's dependent services are configured in the [dependencies docker-compose.yml file](scripts/deps/docker-compose.yml). 98 | - Orchestrate services are configured in [main docker-compose.yml file](docker-compose.yml). 99 | - The Besu node is configured in the [Besu docker-compose-besu.yml file](scripts/deps/docker-compose-besu.yml). 100 | 101 | To initialize Orchestrate execute: 102 | 103 | ```bash 104 | npm run up 105 | ``` 106 | 107 | ![npm run up console output](static/npm-run-up.png) 108 | 109 | > **Note:** _To stop Orchestrate, run `npm run down`._ > _stops all containers and removes all data volumes._ 110 | 111 | Optionally to initialize a Besu node you have to execute: 112 | 113 | ```bash 114 | npm run up-besu 115 | ``` 116 | 117 | ![npm run up console output](static/npm-run-up-besu.png) 118 | 119 | > **Note:** _To stop Besu, run `npm run down-besu`._ > _stops besu containers and removes all data volumes._ 120 | 121 | ### Install Orchestrate command line interface (CLI) 122 | 123 | Verify that the CLI is properly installed and list all commands: 124 | 125 | ```bash 126 | npm run orchestrate help 127 | ``` 128 | 129 | To access details of each command: 130 | 131 | ```bash 132 | npm run orchestrate [cmd] help 133 | ``` 134 | 135 | **Example:** `npm run orchestrate contracts help` 136 | 137 | ### Copy the environment file 138 | 139 | Depending on the network that you want to use: 140 | 141 | - A local Hyperledger Besu Clique network 142 | - An Infura Rinkeby network. 143 | 144 | Copy the example environment files (`.env.besu.example` 145 | or `.env.infura-rinkeby.example`) to a `.env` file at the root of the project. 146 | 147 | > **Important:** _If using Infura, replace the `NETWORK_ENDPOINT` value in your `.env` file with the 148 | > correct Infura endpoint, including your Infura network project ID._ 149 | 150 | You will define some other variables in this `.env` file later. Using the same `.env` 151 | file throughout enables a consistent experience. 152 | 153 | ## Tutorial 154 | 155 | ## Step 1 - Create an Ethereum account 156 | 157 | ### Create account 158 | 159 | Use the Orchestrate CLI to generate an account: 160 | 161 | ```bash 162 | npm run generate-account 163 | ``` 164 | 165 | ![Generate account console output](static/generate-account.png) 166 | 167 | We use this account as your network faucet. 168 | 169 | ### Copy account address 170 | 171 | Copy the address and include it in the `.env` files as the `FAUCET_ACCOUNT` variable. 172 | 173 | Example: `FAUCET_ACCOUNT=0x6230592812dE2E256D1512504c3E8A3C49975f07` 174 | 175 | ### List accounts stored in Hashicorp Vault 176 | 177 | To view available accounts, run the `hashicorp-accounts` command: 178 | 179 | ```bash 180 | npm run hashicorp-accounts 181 | ``` 182 | 183 | > **Note:** Each account is prefix by its corresponding tenantID, by default is '\_' 184 | 185 | ![Hashicorp accounts listing](static/hashicorp-accounts.png) 186 | 187 | ### Run Hashicorp Vault commands 188 | 189 | Run any [Hashicorp Vault CLI command](https://www.vaultproject.io/docs/commands/) by running 190 | `npm run hashicorp-vault` followed by the command: 191 | 192 | ```bash 193 | npm run hashicorp-vault -- 194 | ``` 195 | 196 | For example, to display the [vault token](https://www.vaultproject.io/docs/concepts/tokens): 197 | 198 | ```bash 199 | npm run hashicorp-vault -- token lookup 200 | ``` 201 | 202 | ## Step 2 - Connect to a blockchain network 203 | 204 | ### Register a blockchain network 205 | 206 | Now that you have Orchestrate up and running and an account created, 207 | it's time to connect Orchestrate to a blockchain network. 208 | 209 | Use the Orchestrate REST API to register a blockchain network: 210 | 211 | ```bash 212 | npm run register-chain 213 | ``` 214 | 215 | ![Create chain console output](static/post-chain.png) 216 | 217 | The chain unique identifier (`uuid`) is displayed in the JSON result. 218 | 219 | > **Note:** _To make this quickstart easy, we provide an NPM command to register the network using 220 | > the variables in the `.env` file. 221 | > Under the hood, it's a Curl post request to Orchestrate REST API. 222 | > Have a look at the `package.json` file for details on this command._ 223 | 224 | ### Copy chain unique identifier 225 | 226 | Copy the chain unique identifier `uuid` and paste it into your `.env` file 227 | as the value for the `CHAIN_UUID` variable. 228 | 229 | Example: `CHAIN_UUID=8a4d0093-c2b7-459b-af2a-8992aa145041` 230 | 231 | > **Note:** _Depending on the network environment file you chose earlier, you connect your Orchestrate 232 | > instance to a private local Besu network or to Rinkeby through [Infura](https://infura.io/). 233 | > You can connect Orchestrate to any Ethereum network using the network RPC endpoint._ 234 | 235 | ### Send a JSON-RPC request through blockchain proxy 236 | 237 | Verify that the chain JSON-RPC is being proxied by Orchestrate: 238 | 239 | ```bash 240 | npm run get-latest-block 241 | ``` 242 | 243 | ![JSON-RPC test response](static/json-rpc-proxy.png) 244 | 245 | > **Note:** _As with creating a chain, we provide an NPM command to make the request. 246 | > Have a look at the `package.json` file for details on this command._ 247 | 248 | ## Step 3 - Configure a faucet 249 | 250 | > **Note:** _On paid gas networks (for example, public networks such as Ethereum mainnet or Rinkeby 251 | > and also some private networks, such as the Besu one used in this quickstart), 252 | > an Ethereum account must have a positive ETH balance to pay transactions fees for mining. 253 | > Orchestrate provides a faucet to enable automatically providing the required ETH to accounts 254 | > managed by Orchestrate_ 255 | 256 | ### Create the faucet on Orchestrate 257 | 258 | A [faucet](https://docs.orchestrate.consensys.net) is defined using a name, a creditor account used 259 | to credit other accounts, and a chain identified by its UUID. 260 | 261 | The following command uses the `CHAIN`, `CHAIN_UUID` and `FAUCET_ACCOUNT` values from the `.env` file to create a faucet. 262 | The faucet is called with the chain name suffixed by `-faucet`. 263 | 264 | Use the Orchestrate API to configure a faucet: 265 | 266 | ```bash 267 | npm run create-faucet 268 | ``` 269 | 270 | ![Create faucet console output](static/post-faucet.png) 271 | 272 | ### Send ETH to the faucet account 273 | 274 | > **Important:** _In order to credit other addresses, the faucet account must have some ETH._ 275 | 276 | If you're not familiar with MetaMask, refer to this [article about getting started with Metamask](https://medium.com/openberry/getting-started-with-metamask-b9ac23a10c83). 277 | 278 | #### Local Besu network 279 | 280 | On the quickstart Besu local network, some [pre-defined accounts are configured with an ETH balance](scripts/deps/config/besu/genesis.json). 281 | 282 | Connect Metamask to `http://localhost:8545` and import one of the genesis account privatekeys and transfer 1 or 2 ETH from one of the test accounts to 283 | your `FAUCET_ACCOUNT` address. 284 | 285 | #### Rinkeby 286 | 287 | If connected to Rinkeby, the recommended approach is to credit the faucet account by transferring 1 or 2 ETH from one of your personal 288 | Rinkeby accounts using [MetaMask](https://metamask.io/). 289 | 290 | ![Credit faucet with MetaMask](static/metamask-credit-faucet.png) 291 | 292 | If you do not have any Rinkeby test ETH, you can request some for free from an [official Rinkeby faucet](https://faucet.rinkeby.io/). 293 | 294 | ## Step 4 - Register a smart contract 295 | 296 | Orchestrate provides a contract registry. 297 | 298 | You can use this registry to deploy contracts on your registered networks. 299 | But first you have to create, compile, and add your contract to the registry. 300 | 301 | ### Compile the smart contract 302 | 303 | ```bash 304 | npm run compile 305 | ``` 306 | 307 | ![Compile contract console output](static/compile-contract.png) 308 | 309 | _The Orchestrate Quickstart uses [Truffle](https://www.trufflesuite.com/) for compiling._ 310 | 311 | > **Note:** _The Quickstart provides a basic Solidity smart contract [Counter.sol](smart-contracts/Counter.sol) 312 | > for demonstration purpose. The contract only increments an integer value._ 313 | 314 | ### Push the smart contract to the Contract Registry 315 | 316 | ```bash 317 | npm run register-contract 318 | ``` 319 | 320 | ![Register contract console output](static/register-contract.png) 321 | 322 | ### List smart contracts stored in the Contract Registry 323 | 324 | ```bash 325 | npm run get-catalog 326 | ``` 327 | 328 | ![Get catalog console output](static/get-catalog.png) 329 | 330 | ## Step 5 - Create an account to send transactions 331 | 332 | Generate an account to be used for sending transactions to the smart contact. 333 | The generated account is stored by the Hashicorp Vault service. 334 | 335 | ```bash 336 | npm run generate-account 337 | ``` 338 | 339 | ![Generate account console output](static/generate-account-faucet.png) 340 | 341 | **Note:** _The generated account is automatically funded by the faucet service configured previously._ 342 | 343 | ### Copy account addresss 344 | 345 | Copy the generated account address and set the `FROM_ACCOUNT` value with this address in `.env` file. 346 | 347 | ### Verify Rinkeby account funded 348 | 349 | If using Rinkeby, you can verify that the account has been properly funded by the faucet using 350 | [Etherscan Rinkeby explorer](https://rinkeby.etherscan.io/). 351 | Search for the account address in the main search field. 352 | 353 | ![Etherscan display of generated account](static/etherscan-account.png) 354 | 355 | ## Step 6 - Deploy a smart contract and send transactions 356 | 357 | ### Listen to transaction receipts events 358 | 359 | Orchestrate manages blockchain transactions that are asynchronous by nature due to blockchain mining time. 360 | Orchestrate provides an event consumer to process transaction receipts when they are generated. 361 | 362 | Orchestrate uses [Apache Kafka](https://kafka.apache.org/) to handle these asynchronous communications. 363 | 364 | In the next steps, we send two kinds of transactions: 365 | 366 | - Create the contract on the chain 367 | - Interact with the contract. 368 | 369 | You have to run a consumer script to listen to the transaction receipt events and see them happen on the network. 370 | 371 | On your current terminal, start the consumer and let the consumer run on foreground by keeping the terminal: 372 | 373 | ```bash 374 | npm run consume 375 | ``` 376 | 377 | > **Reference script:** [consume.ts](src/consume/consume.ts) 378 | 379 | ![Consumer console output](static/npm-consume.png) 380 | 381 | ### Deploy the Smart Contract 382 | 383 | On another terminal, in the same project directory, deploy the smart contract: 384 | 385 | ```bash 386 | npm run deploy 387 | ``` 388 | 389 | After a few seconds (depending on block time), you see the receipt related to the contract creation transaction in the consumer terminal. 390 | 391 | ![Contract deployment transaction receipt](static/npm-deploy.png) 392 | 393 | > **Note:**: You will be required to execute this command twice, first to fund your sender account with enough tokens, then another one to send the actual deploy contract transaction. 394 | 395 | ### Copy contract address 396 | 397 | Copy the `contractAddress` in the receipt and set the `TO_ACCOUNT` value with this address in `.env` file. 398 | 399 | ### Verify Rinkeby contract deployed 400 | 401 | If using Rinkeby, you can verify that the contract was deployed by using 402 | [Etherscan Rinkeby explorer](https://rinkeby.etherscan.io) and searching for the sender address. 403 | 404 | ![Etherscan display of deployed contract on Rinkeby](static/etherscan-deploy.png) 405 | 406 | ### Send a transaction to the smart contract 407 | 408 | > **Important:** _Before moving forward, ensure the `FROM_ACCOUNT` and `TO_ACCOUNT` are set in the `.env` file._ 409 | 410 | On the second terminal, send the transaction: 411 | 412 | ```bash 413 | npm run send-tx 414 | ``` 415 | 416 | After a few seconds (depending on block time), you see the transaction receipt in the consumer 417 | output on the first terminal. 418 | 419 | ![Receipt for transaction sent to the contract](static/npm-send-tx.png) 420 | 421 | ### Verify Rinkeby transaction 422 | 423 | If using Rinkeby, you can verify the transaction was sent using 424 | [Etherscan Rinkeby explorer](https://rinkeby.etherscan.io) and searching for the sender address. 425 | 426 | ![Etherscan display of transaction on Rinkeby](static/etherscan-send-tx.png) 427 | 428 | ## Advanced Tutorial 429 | 430 | ### Send private transactions 431 | 432 | > **Important:** _Before moving forward, ensure the `FROM_ACCOUNT` and is set in the `.env` file._ 433 | 434 | PegaSys Orchestrate is compatible with Quorum Tessera and Besu Orion protocols for private transactions. Private transactions are only available in private networks. 435 | 436 | On the second terminal, send the transaction: 437 | 438 | ```bash 439 | npm run send-private-tx 440 | ``` 441 | 442 | After a few seconds (depending on block time), you see the transaction receipt in the consumer 443 | output on the first terminal. 444 | 445 | ![Receipt for private transaction](static/npm-send-private-tx.png) 446 | 447 | > For more information about private transactions, refer to the [Besu privacy documentation](https://besu.hyperledger.org/Concepts/Privacy/Privacy-Overview/). 448 | 449 | ### Multitenancy 450 | 451 | Multi-tenancy enables serving multiple blockchain applications with a single Orchestrate instance. Resources including transaction streams, access to the blockchain network, private keys, and smart contracts are isolated to the tenant that owns them. 452 | [See more](https://docs.orchestrate.consensys.net/Concepts/Multi-Tenancy/) 453 | 454 | Orchestrate uses the OpenID Connect(OIDC) authentication protocol. JSON Web Tokens (JWTs) with custom claims control access to tenant resources. 455 | 456 | ### Enabling multi-tenancy 457 | 458 | To enable multi-tenancy we need to modify the following variable from our local environment file `.env` as follow: 459 | 460 | ```bash 461 | MULTI_TENANCY_ENABLED=true 462 | AUTH_TOKEN= 463 | ``` 464 | 465 | Then, we need to start Orchestrate again: 466 | 467 | ```bash 468 | npm run down && npm run up 469 | ``` 470 | 471 | #### Using self-generated certificates 472 | 473 | For the sake of simplicity Orchestrate team has provided a dev certificate 474 | to encode and decode the generated JWT. In case you want to use your own certificates, generated for instance with `openssl`, you need to replace the following two ENV vars: 475 | 476 | ``` 477 | AUTH_JWT_CERTIFICATE=MIIDYjCCAkoCCQC9pJWk7qdipjANBgkqhkiG9w0BAQsFADBzMQswCQYDVQQGEwJGUjEOMAwGA1UEBwwFUGFyaXMxEjAQBgNVBAoMCUNvbnNlblN5czEQMA4GA1UECwwHUGVnYVN5czEuMCwGA1UEAwwlZTJlLXRlc3RzLm9yY2hlc3RyYXRlLmNvbnNlbnN5cy5wYXJpczAeFw0xOTEyMjcxNjI5MTdaFw0yMDEyMjYxNjI5MTdaMHMxCzAJBgNVBAYTAkZSMQ4wDAYDVQQHDAVQYXJpczESMBAGA1UECgwJQ29uc2VuU3lzMRAwDgYDVQQLDAdQZWdhU3lzMS4wLAYDVQQDDCVlMmUtdGVzdHMub3JjaGVzdHJhdGUuY29uc2Vuc3lzLnBhcmlzMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAo0NqWqI3TSi1uOBvCUquclWo4LcsYT21tNUXQ8YyqVYRSsiBv+ZKZBCjD8XklLPih40kFSe+r6DNca5/LH/okQIdc8nsQg+BLCkXeH2NFv+QYtPczAw4YhS6GVxJk3u9sfp8NavWBcQbD3MMDpehMOvhSl0zoP/ZlH6ErKHNtoQgUpPNVQGysNU21KpClmIDD/L1drsbq+rFiDrcVWaOLwGxr8SBd/0b4ngtcwH16RJaxcIXXT5AVia1CNdzmU5/AIg3OfgzvKn5AGrMZBsmGAiCyn4/P3PnuF81/WHukk5ETLnzOH+vC2elSmZ8y80HCGeqOiQ1rs66L936wX8cDwIDAQABMA0GCSqGSIb3DQEBCwUAA4IBAQCNcTs3n/Ps+yIZDH7utxTOaqpDTCB10MzPmb22UAal89couIT6R0fAu14p/LTkxdb2STDySsQY2/Lv6rPdFToHGUI9ZYOTYW1GOWkt1EAao9BzdsoJVwmTON6QnOBKy/9RxlhWP+XSWVsY0te6KYzS7rQyzQoJQeeBNMpUnjiQji9kKi5j9rbVMdjIb4HlmYrcE95ps+oFkyJoA1HLVytAeOjJPXGToNlv3k2UPJzOFUM0ujWWeBTyHMCmZ4RhlrfzDNffY5dlW82USjc5dBlzRyZalXSjhcVhK4asUodomVntrvCShp/8C9LpbQZ+ugFNE8J6neStWrhpRU9/sBJx 478 | AUTH_JWT_PRIVATE_KEY=MIIEvAIBADANBgkqhkiG9w0BAQEFAASCBKYwggSiAgEAAoIBAQCjQ2paojdNKLW44G8JSq5yVajgtyxhPbW01RdDxjKpVhFKyIG/5kpkEKMPxeSUs+KHjSQVJ76voM1xrn8sf+iRAh1zyexCD4EsKRd4fY0W/5Bi09zMDDhiFLoZXEmTe72x+nw1q9YFxBsPcwwOl6Ew6+FKXTOg/9mUfoSsoc22hCBSk81VAbKw1TbUqkKWYgMP8vV2uxur6sWIOtxVZo4vAbGvxIF3/RvieC1zAfXpElrFwhddPkBWJrUI13OZTn8AiDc5+DO8qfkAasxkGyYYCILKfj8/c+e4XzX9Ye6STkRMufM4f68LZ6VKZnzLzQcIZ6o6JDWuzrov3frBfxwPAgMBAAECggEARNLHg7t8SoeNy4i45hbYYRRhI5G0IK3t6nQl4YkslBvXIEpT//xpgbNNufl3OYR3SyMhgdWGWe0Ujga8T5sABBj7J3OIp/R3RJFx9nYewwIq8K5VFqNUJWyNYuF3lreEKQHp2Io+p6GasrGR9JjQ95mIGFwfxo/0Pdfzv/5ZhMWTmSTcOi504Vger5TaPobPFOnULq4y1A4eX4puiHDtvx09DUAWbAjGHpCYZjDGRdSXQArYQmUOKy7R46qKT/ollGOWivnEOgsFmXuUWs/shmcrDG4cGBkRrkxyIZhpnpNEEF5TYgulMMzwM+314e8W0lj9iiSB2nXzt8JhEwTz8QKBgQDSCouFj2lNSJDg+kz70eWBF9SQLrBTZ8JcMte3Q+CjCL1FpSVYYBRzwJNvWFyNNv7kHhYefqfcxUVSUnQ1eZIqTXtm9BsLXnTY+uEkV92spjVmfzBKZvtN3zzip97sfMT9qeyagHEHwpP+KaR0nyffAK+VPhlwNMKgQ9rzP4je+QKBgQDG/JwVaL2b53vi9CNh2XI8KNUd6rx6NGC6YTZ/xKVIgczGKTVex/w1DRWFTb0neUsdus5ITqaxQJtJDw/pOwoIag7Q0ttlLNpYsurx3mgMxpYY12/wurvp1NoU3Dq6ob7igfowP+ahUBchRwt1tlezn3TYxVoZpu9dZHtoynOtRwKBgB9vFJJYdBns0kHZM8w8DWzUdCtf0WOqE5xYv4/dyLCdjjXuETi4qFbqayYuwysfH+Zj2kuWCOkxXL6FOH8IQqeyENXHkoSRDkuqwCcAP1ynQzajskZwQwvUbPg+x039Hj4YQCCfOEtBA4T2Fnadmwn0wFJFiOkR/E6f2RSuXX2BAoGALvVqODsxk9s7B0IqH2tbZAsW0CqXNBesRA+w9tIHV2caViFfcPCs+jAORhkkbG5ZZbix+apl+CqQ+trNHHNMWNP+jxVTpTrChHAktdOQpoMu5MnipuLKedI7bPTT/zsweu/FhSFvYd4utzG26J6Rb9hPkOBx9N/KWTXfUcmFJv0CgYAUYVUvPe7MHSd5m8MulxRnVirWzUIUL9Pf1RKWOUq7Ue4oMxzE8CZCJstunCPWgyyxYXgj480PdIuL92eTR+LyaUESb6szZQTxaJfu0mEJS0KYWlONz+jKM4oC06dgJcCMvhgjta2KpXCm3qL1pmKwfFbOLWYBe5uMoHIn9FdJFQ== 479 | ``` 480 | 481 | ### Generate JWT token 482 | 483 | To generate a valid JWT we need to run the following command, where `TENANT_ID=` indicate the tenant id included in our token. 484 | 485 | ``` 486 | TENANT_ID=foo npm run generate-jwt 487 | ``` 488 | 489 | By default the _expiration time is 1h_, in case you want to modify you can use the ENV variable _EXPIRATION_. For instance, to make it 5 hours you execute: 490 | 491 | ``` 492 | EXPIRATION=5h TENANT_ID=foo npm run generate-jwt 493 | ``` 494 | 495 | ![Output of the generate-jwt command](static/generate-jwt.png) 496 | 497 | > **Note:** Decode the generated token using _[https://jwt.io/](https://jwt.io/)_ and verify the correct tenant is included within the selected namespace. 498 | 499 | ### How to test it 500 | 501 | Once we obtain a valid token we just need to update _AUTH_TOKEN=_ from `.env` file. Going back to [tutorial](/#tutorial), if we follow the steps again, every request will be sent using the generated JWT. 502 | 503 | > **Note:**: In some sample cases we need to prefix the token by `Bearer` to be correctly decoded by the Orchestrate services. 504 | --------------------------------------------------------------------------------