Skip to content

Commit

Permalink
Merge pull request #794 from ethereum-oasis-op/feature/759-public-key…
Browse files Browse the repository at this point in the history
…-test-pass-4

Utilise Eddsa & Public Keys - Part 4
  • Loading branch information
Therecanbeonlyone1969 authored Jun 19, 2024
2 parents 5048550 + 6b8e047 commit b5c2b5d
Show file tree
Hide file tree
Showing 71 changed files with 7,517 additions and 8,297 deletions.
11 changes: 6 additions & 5 deletions .github/workflows/bri-3.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,19 +41,20 @@ jobs:
- 4222:4222
env:
DATABASE_URL: "postgresql://postgres:example@localhost:5432/postgres"
GOERLI_RPC_URL: "https://rpc.goerli.eth.gateway.fm"
GOERLI_SERVICE_DID: "did:ethr:0x5:0xB73A16e32FE027838f9aDEf72A192AFFf45a0A9D"
GOERLI_SERVICE_SIGNER_PRIVATE_KEY: "0x0fbdb56ab0fecb2f406fa807d9e6558baedacc1c15c0e2703b77d4c08441e4fe"
DID_REGISTRY: "0x03d5003bf0e79c5f5223588f347eba39afbc3818"
DID_BPI_OPERATOR_PUBLIC_KEY: "0x08872e27BC5d78F1FC4590803369492868A1FCCb"
DID_BPI_OPERATOR_PRIVATE_KEY: "2c95d82bcd8851bd3a813c50afafb025228bf8d237e8fd37ba4adba3a7596d58"
DID_NETWORK: "sepolia"
INFURA_PROVIDER_API_KEY: "c5f37cd25eca4007a9768f18f492bc6f"
SERVICE_URL: "bri-3"
BPI_NATS_SERVER_URL: "localhost:4222"
BPI_NATS_SERVER_USER: "bpi_operator"
BPI_NATS_SERVER_PASS: "liftboiliftboiliftboiliftboi1"
BPI_ENCRYPTION_KEY_K_PARAM: "yzkXp3vY_AZQ3YfLv9GMRTYkjUOpn9x18gPkoFvoUxQ"
BPI_ENCRYPTION_KEY_KTY_PARAM: "oct"
SNARKJS_CIRCUITS_PATH: "zeroKnowledgeArtifacts/circuits/"
VSM_CYCLE_PERIOD_IN_SECS: 15
VSM_CYCLE_TX_BATCH_SIZE: 5
SNARKJS_CIRCUITS_PATH: "zeroKnowledgeArtifacts/circuits/"
CCSM_NETWORK: "goerli"
MERKLE_TREE_HASH_ALGH: "sha256"

steps:
Expand Down
37 changes: 19 additions & 18 deletions examples/bri-3/.env.sample
Original file line number Diff line number Diff line change
Expand Up @@ -4,24 +4,25 @@
# Prisma supports the native connection string format for PostgreSQL, MySQL, SQLite, SQL Server, MongoDB and CockroachDB.
# See the documentation for all the connection string options: https://pris.ly/d/connection-strings

# Explanation of the params can be found in the Readme file.

DATABASE_URL="postgresql://postgres:example@localhost:5432/postgres"
GOERLI_RPC_URL=""
GOERLI_SERVICE_DID="did:ethr:0x5:<bpi_operator_public_key>"
GOERLI_SERVICE_SIGNER_PRIVATE_KEY="<bpi_operator_private_key>"
SERVICE_URL="bri-3"
BPI_NATS_SERVER_URL="localhost:4222"
DATABASE_URL="postgresql://postgres:example@localhost:5432/postgres" # DB connection string
DID_REGISTRY="0x03d5003bf0e79c5f5223588f347eba39afbc3818" # Sepolia did registry https://sepolia.etherscan.io/address/0x03d5003bf0e79c5f5223588f347eba39afbc3818#code
DID_BPI_OPERATOR_PUBLIC_KEY="<bpi_operator_public_key>" # bpi_operator_public_key = public key of the bpi operator that represents the issuer of the JWT token
DID_BPI_OPERATOR_PRIVATE_KEY="<bpi_operator_private_key>" # bpi_operator_private_key = private key of the bpi operator that is used to sign the issued JWT token
DID_NETWORK="sepolia" # network used to resolve dids
INFURA_PROVIDER_API_KEY="<infura_api_key>" # API key of the infura account used to connect to the network
SERVICE_URL="bri-3" # JWT token audience
BPI_NATS_SERVER_URL="localhost:4222" # URL of the local NATS server instance used by the BPI
BPI_NATS_SERVER_USER="bpi_operator"
BPI_NATS_SERVER_PASS="liftboiliftboiliftboiliftboi1"
BPI_ENCRYPTION_KEY_K_PARAM="yzkXp3vY_AZQ3YfLv9GMRTYkjUOpn9x18gPkoFvoUxQ"
BPI_ENCRYPTION_KEY_K_PARAM="yzkXp3vY_AZQ3YfLv9GMRTYkjUOpn9x18gPkoFvoUxQ" # Encryption key params used by the BPI for Bpi Messages encryption at rest
BPI_ENCRYPTION_KEY_KTY_PARAM="oct"
SNARKJS_CIRCUITS_PATH="zeroKnowledgeArtifacts/circuits/"
VSM_CYCLE_PERIOD_IN_SECS=15
VSM_CYCLE_TX_BATCH_SIZE=5
CCSM_NETWORK="<hardhat | goerli | ganache>"
ALCHEMY_GOERLI_PRIVATE_KEY="<alchemy_goerli_testnet_private_key>"
ALCHEMY_URL="https://eth-goerli.g.alchemy.com/v2/<alchemy_api>"
GANACHE_URL="<ganache_rpc_server_url>"
GANACHE_ACCOUNT_PRIVATE_KEY="<ganache_account_private_key>"
MERKLE_TREE_HASH_ALGH="sha256"
SNARKJS_CIRCUITS_PATH="zeroKnowledgeArtifacts/circuits/" # used to construct the path to the circuit artifacts for a specific workstep by following this convention:
# SNARKJS_CIRCUITS_PATH + <workstep_name_in_snake_case>/<workstep_name_in_snake_case> + suffix for the artifact. Artifact suffixes:
# Circuit proving key = 'final.zkey'
# Circuit verification key = '_verification_key.json'
# Compiled circuit = '_js/<workstep_name_in_snake_case>.wasm'
# Witness calculator = '_js/witness_calculator.js'
# Witness file = '_js/witness.txt'
VSM_CYCLE_PERIOD_IN_SECS=15 # How many seconds before each VSM cycle
VSM_CYCLE_TX_BATCH_SIZE=5 # How many transactions to execute in the single VSM cycle
MERKLE_TREE_HASH_ALGH="sha256" # Hash algorithm used in creation of Merkle Tree
3 changes: 0 additions & 3 deletions examples/bri-3/.gitignore
Original file line number Diff line number Diff line change
@@ -1,13 +1,10 @@
# compiled output
/dist
/node_modules
/zeroKnowledgeArtifacts/ptau
/zeroKnowledgeArtifacts/circuits
src/bri/zeroKnowledgeProof/services/circuit/snarkjs/*.sol
/zeroKnowledgeArtifacts/blockchain/ethereum/artifacts
/typechain-types
/cache
/zeroKnowledgeArtifacts/circuits

# Logs
logs
Expand Down
25 changes: 3 additions & 22 deletions examples/bri-3/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@ $ npm run prisma:generate # generate the prisma client
$ npm run prisma:migrate:dev # migrate the db to latest state
$ npx prisma db seed # seed db

$ npx prisma migrate reset # reset the db to initial state, remove all data and apply seed

```

## Messaging
Expand All @@ -45,28 +47,7 @@ Relevant information can be found in ./docs/nats/nats-configuration.md

## Environment configuration

Can be found in ./env.sample. Explanation:

```bash
DATABASE_URL="postgresql://postgres:example@localhost:5432/postgres" # DB connection string
GOERLI_RPC_URL="" # Any GOERLI RPC url i.e. "https://rpc.ankr.com/eth_goerli". This is used to resolve dids
GOERLI_SERVICE_DID="did:ethr:0x5:<bpi_operator_public_key>" # bpi_operator_public_key = public key of the bpi operator that represents the issuer of the JWT token
GOERLI_SERVICE_SIGNER_PRIVATE_KEY="<bpi_operator_private_key>" # bpi_operator_private_key = private key of the bpi operator that is used to sign the issued JWT token
SERVICE_URL="bri-3" # JWT token audience
BPI_NATS_SERVER_URL="localhost:4222" # URL of the local NATS server instance used by the BPI
BPI_NATS_SERVER_USER="bpi_operator"
BPI_NATS_SERVER_PASS="liftboiliftboiliftboiliftboi1"
BPI_ENCRYPTION_KEY_K_PARAM="yzkXp3vY_AZQ3YfLv9GMRTYkjUOpn9x18gPkoFvoUxQ" # Encryption key params used by the BPI for Bpi Messages encryption at rest
BPI_ENCRYPTION_KEY_KTY_PARAM="oct"
SNARKJS_CIRCUITS_PATH="zeroKnowledgeArtifacts/circuits/" # used to construct the path to the circuit artifacts for a specific workstep by following this convention:
# SNARKJS_CIRCUITS_PATH + <workstep_name_in_snake_case>/<workstep_name_in_snake_case> + suffix for the artifact. Artifact suffixes:
# Circuit proving key = '_circuit_final.zkey'
# Circuit verification key = '_circuit_verification_key.json'
# Compiled circuit = '_circuit.wasm'
VSM_CYCLE_PERIOD_IN_SECS=15 # How many seconds before each VSM cycle
VSM_CYCLE_TX_BATCH_SIZE=5 # How many transactions to execute in the single VSM cycle
MERKLE_TREE_HASH_ALGH="sha256" # Hash algorithm used in creation of Merkle Tree
```
Can be found in ./env.sample.

Relevant information on DID Auth can be found in ./docs/dids/did-authentication.md

Expand Down
10 changes: 5 additions & 5 deletions examples/bri-3/docs/dids/did-authentication.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,21 +14,21 @@ Hence, Bri-3 utilizes the self-sovereign nature of decentralized identifiers (DI

## Environment Variables Explanation

**GOERLI_RPC_URL**= "<Any GOERLI_RPC_URL i.e. _https://rpc.ankr.com/eth_goerli_>"
**DID_REGISTRY**= "<address of the did registry smart contract>"

#This is used to resolve dids.
#This is did registry address on a given network used to resolve dids. Example:https://sepolia.etherscan.io/address/0x03d5003bf0e79c5f5223588f347eba39afbc3818#code

**GOERLI_SERVICE_DID**="did:ethr:0x5:<bpi_operator_public_key>"
**DID_BPI_OPERATOR_PUBLIC_KEY**="did:ethr:sepolia:<bpi_operator_public_key>"

#bpi_operator_public_key = public key of the bpi operator that represents the issuer of the JWT token. Users can retrieve their public key by accessing their blockchain account settings or using a wallet provider like [MetaMask](https://metamask.io/).

where
1. did - the did URI scheme identifier
2. ethr - the identifier for the DID method
3. 0x5 - Specify GOERLI Test Network
3. sepolia - Specify SEPOLIA Test Network
4. bpi_operator_public_key - the DID method-specific identifier

**GOERLI_SERVICE_SIGNER_PRIVATE_KEY**="<bpi_operator_private_key>"
**DID_BPI_OPERATOR_PRIVATE_KEY**="<bpi_operator_private_key>"

#bpi_operator_private_key = private key of the bpi operator that is used to sign the issued JWT token. Similar to the public key. For more information on how to view and access the public and private keys, please refer to the [MetaMask support](https://support.metamask.io/hc/en-us/articles/360015488791-How-to-view-your-account-details-and-public-address).

Expand Down
2 changes: 1 addition & 1 deletion examples/bri-3/hardhat.config.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/** @type import('hardhat/config').HardhatUserConfig */

require('@nomiclabs/hardhat-ethers');
require('@nomicfoundation/hardhat-ethers');
require('@nomicfoundation/hardhat-toolbox');
require('dotenv/config');
module.exports = {
Expand Down
Loading

0 comments on commit b5c2b5d

Please sign in to comment.