Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WIP: Flextesa configs #31

Draft
wants to merge 20 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM node:lts-alpine
FROM node:14-alpine

ADD package.json package.json
ADD package-lock.json package-lock.json
Expand Down
24 changes: 24 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
## key-gen

The key-gen service will sign or provide secrets for pre-funded Tezos accounts. This service is helpful for testing and development workflows where the user needs to sign operations.

The service requires a main "funder account." Key-gen generates a new pool of accounts in the target chain and funds each from the main funder account. Key-gen will maintain the size of the address pools.

key-gen is used in Taquito's CI/CD integration tests and allows them to run in parallel, making CI/CD jobs finish sooner. The Taquito test suite will fetch a new secret from key-gen or request key-gen to sign an operation.

## Configuration files

### Managing Authenticaion `accounts-config.json`

The key-gen API offers basic authentication which is configured in the `accounts-config.json` file.

```json
{
"flextesanet-t0k3n": { // The auth token exptected in the `Authorization:` HTTP header
"flextesanet": { // The network name, corresponds to entries in `pools.config.json`
"regular": "flextesanet", // Referts to a config entry in `pools-config.json`
"ephemeral": "ephemeral-keys-flextesanet" // Refers to a config entry in `ephemeral-config.json`
}
}
}
```
18 changes: 15 additions & 3 deletions accounts-config.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,21 @@
}
},
"taquito-example": {
"babylonnet": {
"regular": "taquito-example-babylonnet",
"ephemeral": "ephemeral-keys-babylonnet"
"granadanet": {
"regular": "taquito-example-granadanet",
"ephemeral": "ephemeral-keys-granadanet"
},
"edonet": {
"regular": "taquito-example-edonet",
"ephemeral": "ephemeral-keys-edonet"
},
"florencenet": {
"regular": "taquito-example-florencenet",
"ephemeral": "ephemeral-keys-florencenet"
},
"flextesanet": {
"regular": "taquito-example-flextesanet",
"ephemeral": "ephemeral-keys-flextesanet"
}
}
}
14 changes: 14 additions & 0 deletions accounts-config.single.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"ligo-ide": {
"babylonnet": {
"regular": "ligo-ide-babylonnet",
"ephemeral": "ephemeral-keys-babylonnet"
}
},
"taquito-example": {
"flextesanet": {
"regular": "taquito-example-flextesanet",
"ephemeral": "ephemeral-keys-flextesanet"
}
}
}
11 changes: 10 additions & 1 deletion docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ version: '3'
services:
redis:
image: bitnami/redis
logging:
driver: json-file
ports:
- 6379:6379
environment:
Expand All @@ -10,7 +12,14 @@ services:
- /bitnami/redis/data
signatory:
image: ecadlabs/signatory:latest
logging:
driver: json-file
ports:
- 6732:6732
volumes:
- ./signatory.yaml:/app/signatory.yaml
- ./signatory.yaml:/etc/signatory.yaml
- ./key_gen_funder.key:/etc/key_gen_funder.key
networks:
default:
external: true
name: github_runner
25 changes: 20 additions & 5 deletions ephemeral-config.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,22 @@
{
"ephemeral-keys-babylonnet": {
"maxAmount": 1,
"expire": 3600,
"pool-id": "ephemeral-keys-babylonnet"
"ephemeral-keys-granadanet": {
"maxAmount": 30,
"expire": 300,
"pool-id": "ephemeral-keys-granadanet"
},
"ephemeral-keys-edonet": {
"maxAmount": 30,
"expire": 300,
"pool-id": "ephemeral-keys-edonet"
},
"ephemeral-keys-florencenet": {
"maxAmount": 30,
"expire": 300,
"pool-id": "ephemeral-keys-florencenet"
},
"ephemeral-keys-flextesanet": {
"maxAmount": 30,
"expire": 300,
"pool-id": "ephemeral-keys-flextesanet"
}
}
}
7 changes: 7 additions & 0 deletions ephemeral-config.single.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"ephemeral-keys-flextesanet": {
"maxAmount": 300,
"expire": 300,
"pool-id": "ephemeral-keys-flextesanet"
}
}
9 changes: 9 additions & 0 deletions examples/flextesa/accounts-config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"flextesanet-t0k3n": {
"flextesanet": {
"regular": "flextesanet",
"ephemeral": "ephemeral-keys-flextesanet"
}
}
}

38 changes: 38 additions & 0 deletions examples/flextesa/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
version: '3'
services:
redis:
image: bitnami/redis
environment:
- REDIS_PASSWORD=password123
volumes:
- /bitnami/redis/data
signatory:
image: ecadlabs/signatory:latest
volumes:
- ./signatory.yaml:/etc/signatory.yaml
- ./key_gen_funder.key:/etc/key_gen_funder.key
key-gen:
image: ecadlabs/tezos-key-gen-api:flextesa
ports:
- "${KEYGEN_PORT_MAPPING:-3000:3000}"
#- 3001:3001 #Prometheus metrics
environment:
- REDIS_HOST=redis
- REDIS_PASSWORD=password123
volumes:
- ./pools-config.json:/pools-config.json
- ./accounts-config.json:/accounts-config.json
- ./ephemeral-config.json:/ephemeral-config.json
flextesa:
image: "${FLEXTESA_IMAGE:-tqtezos/flextesa:20210602}"
environment:
- TEZOS_LOG=rpc -> INFO
ports:
- "${FLEXTESA_RPC_PORT_MAPPING:-8732:20000}"
command: "${FLEXTESA_BOX:-flobox} start"

networks:
default:
external: true
name: flextesa

7 changes: 7 additions & 0 deletions examples/flextesa/ephemeral-config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"ephemeral-keys-flextesanet": {
"maxAmount": 30,
"expire": 300,
"pool-id": "ephemeral-keys-flextesanet-alice"
}
}
6 changes: 6 additions & 0 deletions examples/flextesa/key_gen_funder.key
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
[
{
"name": "key_alice",
"value": "unencrypted:edsk3QoqBuvdamxouPhin7swCvkQNgq4jP5KZPbwWNnwdZpSpJiEbq"
}
]
21 changes: 21 additions & 0 deletions examples/flextesa/pools-config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
{
"flextesanet": {
"funderPKH": "tz1VSUr8wwNhLAzempoch5d6hLRiTh8Cjcjb",
"remoteSignerUrl": "http://signatory:6732",
"batchSize": 500,
"targetBuffer": 100,
"tzAmount": 20,
"rpcUrl": "http://flextesa:20000/",
"redisListName": "example:flextesanet-alice:address-pool"
},
"ephemeral-keys-flextesanet-alice": {
"funderPKH": "tz1VSUr8wwNhLAzempoch5d6hLRiTh8Cjcjb",
"remoteSignerUrl": "http://signatory:6732",
"batchSize": 500,
"targetBuffer": 100,
"tzAmount": 20,
"autoRefillDurationMS": 30000,
"rpcUrl": "http://flextesa:20000/",
"redisListName": "ephemeral-keys:flextesanet:address-pool"
}
}
24 changes: 24 additions & 0 deletions examples/flextesa/signatory.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
server:
# Default port 6732
address: :6732
# Default port 9583
utility_address: :9583
vaults:
local_file_keys:
driver: file
config:
# tz1Rb18fBaZxkzDgFGAbcBZzxLCYdxyLryVX
file: /etc/key_gen_funder.key
# List enabled public keys hashes here
tezos:
tz1VSUr8wwNhLAzempoch5d6hLRiTh8Cjcjb: #Flextesa well known account "Alice"
allowed_operations:
# List of [generic, block, endorsement]
- generic
- block
- endorsement
allowed_kinds:
# List of [endorsement, ballot, reveal, transaction, origination, delegation, seed_nonce_revelation, activate_account]
- transaction
- endorsement
- reveal
1 change: 1 addition & 0 deletions key_gen_funder.key
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
[{ "name": "key_gen_funder", "value": "unencrypted:edskRonBXEZFZPjsMiqsa9YaECifKjHJCGiUeLmyT5Fc6aF4ppgDRcUsdfkp8X8pvD1RcZ8jShDqSjXGj5rNxdatHEeQznFw5C" }]
Loading