This project is developed with go 1.19. You probably would need a working golang environment to use it.
You can also use the docker and docker compose files to run the project in case you do not want to compile by yoursef.
Nice to have (Not all of them are strictly required but highly recommended):
- Go 1.19.
- Makefile.
- Docker.
- Docker-compose.
- Unix style operating system (Linux, Mac, Windows WSL)
Services needed:
- Postgres
- Redis
- Hashicorp vault.
For your convenience, the testing environment can run these three services (Postgres, Redis and Vault) in a docker for you. Please, consider that this is just for testing or evaluation purposes and SHOULD never be used in production without securing it.
- Configure the project creating config.toml file.
- Run
make up
to launch 3 containers with a postgres, redis and vault. This 3 containers are provided only for evaluation purposes. - Run
make run
to start a docker container running the issuer, (make run-arm
for Mac computers with Apple Silicon chip) - Follow the steps to write the private key in the vault
- Browse to http://localhost:3001 (or the port configured in ServerPort config entry)
- Configure the project creating config.toml file.
- Run
make up
to launch 3 containers with a postgres, redis and vault. This 3 containers are provided only for evaluation purposes. - Run
make run-ui-backend
to start a docker container running the issuer, (make run-arm-ui-backend
for Mac computers with Apple Silicon chip) - Follow the steps to write the private key in the vault
- Browse to http://localhost:3002 (or the port configured in ServerAdminPort config entry)
- Configure the project creating a config.toml file copying the original config.toml.sample. The same variables can be injected as environment variables for your convenience. Please, see configuration section
- Compile it with
make build
. You need a golang 1.19 environment to do it. make build will run a go install so it will generate a binary for each of the commands:- platform
- migrate
- pending_publisher
- configurator
- Make sure you have postgres, redis and hashicorp vault properly configured. You could use
make up
command to start a postgres, redis and vault redis container. Use this images only for evaluation purposes. - Make sure that your database is properly configured (step 1) and run
make db/migrate
command. This will check for the current structure of the database and will apply needed change to create or update the database schema. - Write the vault token in the config.toml file, once the vault is initialized the token can be found in infrastructure/local/.vault/data/init.out or in the logs of the vault container.
- Run
./bin/platform
command to start the issuer. Browse to http://localhost:3001 (or the port configured in ServerPort config entry) This will show you the api documentation. - Run
./bin/pending_publisher
in background. This process is not strictly necessary but highly recommended. It checks for possible errors publishing transactions on chain and try to resend it. - Follow the steps to write the private key in the vault
The server can be configured with a config file and/or environment variables. There is a config.toml.sample file provided as a reference. The system expects to have a config.toml file in the working directory.
Any variable defined in the config file can be overwritten using environment variables. The binding for this environment variables is defined in the function bindEnv() in file internal/config/config.go
A helper command is provided under the command make config
to help in the generation of the config file.
- docker exec -it sh-id-platform-test-vault sh
- vault write iden3/import/pbkey key_type=ethereum private_key=
- Start the testing environment
make up-test
- Run tests
make tests
to run test ormake test-race
to run tests with go test --race - Run linter
make lint