Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: decentralized-identity/ion
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: v1.0.3
Choose a base ref
...
head repository: decentralized-identity/ion
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: master
Choose a head ref
Loading
Showing with 17,545 additions and 2,700 deletions.
  1. +2 −0 .eslintignore
  2. +45 −0 .eslintrc.json
  3. +24 −0 .github/workflows/docker-compose-test.yml
  4. +67 −0 .github/workflows/docker-publish.yml
  5. +4 −1 .gitignore
  6. +32 −13 bin/OperationCommand.ts
  7. +21 −0 config/docker-mainnet-bitcoin-config.json
  8. +11 −0 config/docker-mainnet-core-config.json
  9. +21 −0 config/docker-testnet-bitcoin-config.json
  10. +11 −0 config/docker-testnet-core-config.json
  11. 0 {json → config}/mainnet-bitcoin-config.json
  12. 0 {json → config}/mainnet-bitcoin-docker-config.json
  13. 0 {json → config}/mainnet-bitcoin-versioning.json
  14. 0 {json → config}/mainnet-core-config.json
  15. 0 {json → config}/mainnet-core-docker-config.json
  16. 0 {json → config}/mainnet-core-versioning.json
  17. 0 {json → config}/regtest-bitcoin-config.json
  18. 0 {json → config}/regtest-bitcoin-versioning.json
  19. 0 {json → config}/regtest-core-config.json
  20. 0 {json → config}/regtest-core-versioning.json
  21. 0 {json → config}/testnet-bitcoin-config.json
  22. 0 {json → config}/testnet-bitcoin-versioning.json
  23. 0 {json → config}/testnet-core-config.json
  24. 0 {json → config}/testnet-core-versioning.json
  25. +94 −29 docker/README.md
  26. +0 −135 docker/deploy-docker-mainnet.sh
  27. +18 −0 docker/docker-compose.testnet-override.yml
  28. +41 −52 docker/docker-compose.yml
  29. +5 −0 docker/dockerfile
  30. +24 −0 docker/test_compose.sh
  31. +2 −2 docs/Q-and-A.md
  32. +222 −6 docs/design.md
  33. +1 −1 docs/operating-model.md
  34. +37 −7 install-guide.md
  35. +1 −1 ion/index.html
  36. +39 −35 ion/install-guide/index.html
  37. +2 −2 ion/js/charts/highstock.data.js
  38. +1 −1 ion/js/compiled/charts.js
  39. +5 −5 ion/js/explorer.js
  40. +25 −25 ion/js/particles.js
  41. +16,684 −2,293 package-lock.json
  42. +29 −16 package.json
  43. +3 −3 readme.md
  44. +42 −14 src/bitcoin.ts
  45. +28 −9 src/core.ts
  46. 0 tests/{json → config}/bitcoin-config-test.json
  47. +4 −4 tests/src/bitcoin.spec.ts
  48. +0 −46 tslint.json
2 changes: 2 additions & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
node_modules
**/*.json
45 changes: 45 additions & 0 deletions .eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
{
"env": {
"es6": true,
"node": true,
"jasmine": true
},
"extends": [
"standard"
],
"globals": {
"Atomics": "readonly",
"SharedArrayBuffer": "readonly"
},
"parser": "@typescript-eslint/parser",
"parserOptions": {
"ecmaVersion": 11,
"sourceType": "module"
},
"plugins": [
"@typescript-eslint"
],
"rules": {
"dot-notation": ["off"],
"max-len": ["error", { "code": 160, "ignoreStrings": true }],
"no-multi-spaces": ["error", { "ignoreEOLComments": true }],
"no-unneeded-ternary": "off",
"no-unused-vars": "off",
"@typescript-eslint/no-unused-vars": [
"error",
{
"vars": "all",
"args": "after-used",
"ignoreRestSiblings": true,
"argsIgnorePattern": "^_"
}
],
"no-useless-constructor": "off",
"@typescript-eslint/no-useless-constructor": ["error"],
"padded-blocks": ["off"],
"quotes": ["error", "single", { "avoidEscape": true, "allowTemplateLiterals": true} ],
"semi": ["off"],
"@typescript-eslint/semi": ["error", "always"],
"sort-imports": "error"
}
}
24 changes: 24 additions & 0 deletions .github/workflows/docker-compose-test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
name: Docker Compose Test

on:
push:
branches:
- master
pull_request:
branches:
- master

jobs:
test:
runs-on: ubuntu-latest

steps:
- name: Check out the repository
uses: actions/checkout@v2

- name: Set up Docker
uses: docker/setup-buildx-action@v1

- name: Run test script
run: |
./docker/test_compose.sh
67 changes: 67 additions & 0 deletions .github/workflows/docker-publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
# This workflow uses actions that are not certified by GitHub.
# They are provided by a third-party and are governed by
# separate terms of service, privacy policy, and support
# documentation.

# GitHub recommends pinning actions to a commit SHA.
# To get a newer version, you will need to update the SHA.
# You can also reference a tag or branch, but the action may change without warning.

name: Create and publish a Docker image

on:
push:
branches: ['master']

env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}

jobs:


build-and-push-image:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write



steps:
- name: Checkout repository
uses: actions/checkout@v3

- name: Install Node.js and NPM
uses: actions/setup-node@v2
with:
node-version: '18.x'

- name: Install dependencies
run: npm install

- name: Build application
run: npm run build


- name: Log in to the Container registry
uses: docker/login-action@f054a8b539a109f9f41c372932f1ae047eff08c9
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@98669ae865ea3cffbcbaa878cf57c20bbf1c6c38
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}

- name: Build and push Docker image
uses: docker/build-push-action@ad44023a93711e3deb337508980b4b5e9bcdc5dc
with:
context: .
file: docker/dockerfile
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -7,4 +7,7 @@ nunitresults.xml
coverage/

# sidetree-ipfs data folder
sidetree-ipfs/
sidetree-ipfs/

.DS_Store
.idea/*
45 changes: 32 additions & 13 deletions bin/OperationCommand.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { IonDid, IonDocumentModel, IonKey, IonRequest } from '@decentralized-identity/ion-sdk';
import * as fs from 'fs';
import LogColor from './LogColor';
import OperationGenerator from '@decentralized-identity/sidetree/dist/tests/generators/OperationGenerator';

/**
* Class that handles the `operation` CLI command.
@@ -10,31 +10,50 @@ export default class OperationCommand {
* Handles the `create` sub-command.
*/
public static async handleCreate () {
const createOperationData = await OperationGenerator.generateCreateOperation();
const didSuffix = createOperationData.createOperation.didUniqueSuffix;

console.info(LogColor.lightBlue(`DID: `) + LogColor.yellow(`did:ion:${createOperationData.createOperation.didUniqueSuffix}`));
const [recoveryKey, recoveryPrivateKey] = await IonKey.generateEs256kOperationKeyPair();
const [updateKey, updatePrivateKey] = await IonKey.generateEs256kOperationKeyPair();
const [signingKey, signingPrivateKey] = await IonKey.generateEs256kDidDocumentKeyPair({id: 'signing-key'});
const publicKeys = [signingKey];

const document : IonDocumentModel = {
publicKeys
};
const input = { recoveryKey, updateKey, document };
const createRequest = IonRequest.createCreateRequest(input);
const longFormDid = IonDid.createLongFormDid(input);
const shortFormDid = longFormDid.substring(0, longFormDid.lastIndexOf(':'));
const didSuffix = shortFormDid.substring(shortFormDid.lastIndexOf(':') + 1);

console.info(LogColor.lightBlue(`DID: `) + LogColor.yellow(`${shortFormDid}`));
console.info('');

// Save the private signing and recovery keys.
// Save all private keys.
const recoveryKeyFileName = `${didSuffix}-RecoveryPrivateKey.json`;
const updateKeyFileName = `${didSuffix}-UpdatePrivateKey.json`;
const signingKeyFileName = `${didSuffix}-SigningPrivateKey.json`;
fs.writeFileSync(recoveryKeyFileName, JSON.stringify(createOperationData.recoveryPrivateKey));
fs.writeFileSync(signingKeyFileName, JSON.stringify(createOperationData.signingPrivateKey));
fs.writeFileSync(recoveryKeyFileName, JSON.stringify(recoveryPrivateKey));
fs.writeFileSync(updateKeyFileName, JSON.stringify(updatePrivateKey));
fs.writeFileSync(signingKeyFileName, JSON.stringify(signingPrivateKey));
console.info(LogColor.brightYellow(`Recovery private key saved as: ${LogColor.yellow(recoveryKeyFileName)}`));
console.info(LogColor.brightYellow(`Siging private key saved as: ${LogColor.yellow(signingKeyFileName)}`));
console.info(LogColor.brightYellow(`Update private key saved as: ${LogColor.yellow(updateKeyFileName)}`));
console.info(LogColor.brightYellow(`Signing private key saved as: ${LogColor.yellow(signingKeyFileName)}`));
console.info('');

console.info(LogColor.lightBlue(`Create request body:`));
console.info(JSON.stringify(createOperationData.operationRequest, null, 2)); // 2 space indents.
console.info(JSON.stringify(createRequest, null, 2)); // 2 space indents.
console.info('');

console.info(LogColor.lightBlue(`Long-form DID:`));
console.info(longFormDid);
console.info('');

console.info(LogColor.lightBlue(`Decoded suffix data:`));
console.info(createOperationData.createOperation.suffixData);
console.info(LogColor.lightBlue(`DID suffix data:`));
console.info(JSON.stringify(createRequest.suffixData, null, 2));
console.info('');

console.info(LogColor.lightBlue(`Decoded delta:`));
console.info(createOperationData.createOperation.delta);
console.info(LogColor.lightBlue(`Document delta:`));
console.info(JSON.stringify(createRequest.delta, null, 2));
console.info('');
}
}
21 changes: 21 additions & 0 deletions config/docker-mainnet-bitcoin-config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
{
"bitcoinDataDirectory": "/data/bitcoin",
"bitcoinFeeSpendingCutoffPeriodInBlocks": 1,
"bitcoinFeeSpendingCutoff": 0.001,
"bitcoinPeerUri": "http://bitcoin-core:8332",
"bitcoinRpcUsername": "user",
"bitcoinRpcPassword": "password",
"bitcoinWalletOrImportString": "5Kb8kLf9zgWQnogidDA76MzPL6TsZZY36hWXMssSzNydYXYB9KF",
"databaseName": "ion-mainnet-bitcoin",
"genesisBlockNumber": 667000,
"logRequestError": true,
"mongoDbConnectionString": "mongodb://mongo:27017/",
"port": 3002,
"sidetreeTransactionFeeMarkupPercentage": 1,
"sidetreeTransactionPrefix": "ion:",
"transactionPollPeriodInSeconds": 60,
"valueTimeLockUpdateEnabled": false,
"valueTimeLockAmountInBitcoins": 0,
"valueTimeLockPollPeriodInSeconds": 600,
"valueTimeLockTransactionFeesAmountInBitcoins": 0.0001
}
11 changes: 11 additions & 0 deletions config/docker-mainnet-core-config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"batchingIntervalInSeconds": 600,
"blockchainServiceUri": "http://ion-bitcoin:3002",
"databaseName": "ion-mainnet-core",
"didMethodName": "ion",
"ipfsHttpApiEndpointUri": "http://ipfs:5001",
"maxConcurrentDownloads": 20,
"mongoDbConnectionString": "mongodb://mongo:27017/",
"observingIntervalInSeconds": 60,
"port": 3000
}
21 changes: 21 additions & 0 deletions config/docker-testnet-bitcoin-config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
{
"bitcoinDataDirectory": "/data/bitcoin/testnet3",
"bitcoinFeeSpendingCutoffPeriodInBlocks": 1,
"bitcoinFeeSpendingCutoff": 0.001,
"bitcoinPeerUri": "http://bitcoin-core:18332",
"bitcoinRpcUsername": "user",
"bitcoinRpcPassword": "password",
"bitcoinWalletOrImportString": "cSTnTdPxKTHD1R2BAt42sDsQss2ByxHbFeL7nmT3o2mRAbQW1C97",
"databaseName": "ion-testnet-bitcoin",
"genesisBlockNumber": 1900000,
"logRequestError": true,
"mongoDbConnectionString": "mongodb://mongo:27017/",
"port": 3002,
"sidetreeTransactionFeeMarkupPercentage": 1,
"sidetreeTransactionPrefix": "ion:",
"transactionPollPeriodInSeconds": 60,
"valueTimeLockUpdateEnabled": false,
"valueTimeLockAmountInBitcoins": 0,
"valueTimeLockPollPeriodInSeconds": 600,
"valueTimeLockTransactionFeesAmountInBitcoins": 0.0001
}
11 changes: 11 additions & 0 deletions config/docker-testnet-core-config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"batchingIntervalInSeconds": 600,
"blockchainServiceUri": "http://ion-bitcoin:3002",
"databaseName": "ion-testnet-core",
"didMethodName": "ion:test",
"ipfsHttpApiEndpointUri": "http://ipfs:5001",
"maxConcurrentDownloads": 20,
"mongoDbConnectionString": "mongodb://mongo:27017/",
"observingIntervalInSeconds": 60,
"port": 3000
}
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Loading