README (3846B)
1 # C2EC 2 3 The cashless2ecash (C2EC) component, allows withdrawing taler in an indirect 4 transaction. This means that the reserve is created if a payment system provider 5 called the `provider` confirms, that the payment was successful and the withdrawal 6 can be executed. 7 8 ## Build, Config, Run 9 10 ### Build 11 12 IMPORTANT: You need at least Go v1.22! 13 14 To build the executable, simply run `go build .` inside the `c2ec`-directory. 15 16 ### Config 17 18 By default, the C2EC executable will look for a config file called 19 `c2ec-config.yaml` in the directory it is executed. If you want to run C2EC with 20 a config located somewhere else, supply the path to the config file like: 21 22 `./c2ec -c my-custom-conf.conf` 23 24 `c2ec` understands the .ini format. The default configuration is also available in .ini 25 format. 26 27 ### Running 28 29 To run the application just execute the binary built during the build step above: 30 31 `./c2ec` 32 33 With non-default config: 34 35 `./c2ec -c /my/custom/config/location.yaml` 36 37 ## Adding Providers and Terminals 38 39 Adding providers and terminals belonging to them is a task which must be fulfilled 40 by the operator of the C2EC component (usually the operator of the Exchange). 41 42 To add providers and terminal, see the [**c2ec-cli**](https://git.taler.net/cashless2ecash.git/tree/cli). 43 44 ## Simulation 45 46 In testing mode, a Simulation Provider and terminal can be used to simulate the 47 flow of the withdrawal from the creation of the `WOPID` on the side of the 48 Terminal until the confirmation of the payment by the attestor. Since the 49 withdrawal itself is done by the wallet directly at the exchange, the simulation 50 does not capture this. 51 52 ### Add Simulation Provider 53 54 Run the **c2ec-cli** and after connecting to the database using the `db` command, 55 run `rp`. It will ask you for four things: 56 57 1. the name of the provider, which MUST be `Simulation` 58 2. the payto target type as registered in the [GANA](https://gana.gnunet.org/payto-payment-target-types/payto_payment_target_types.html). It is suggested to use `void`, which is meant for testing. 59 3. the provider's backend base url. Enter anything, will not be used by the Simulation 60 4. the provider's backend credentials. Enter anything, will not be used by the Simulation 61 62 ### Add Simulation Terminal 63 64 Run the **c2ec-cli** and after connecting to the database using the `db` command, 65 run `rt`. It will ask you for two things: 66 67 1. the description. Enter a description which makes sense. In the case of the simulation something like `this is a simulation terminal.` might make sense. In a real world case something like the location of the device, an identifier and other similar information might be supplied. 68 2. the name of the provider, which the device belongs to. In the simulation case this will MUST be `Simulation`. 69 70 Be aware that a terminal can only be added, after the provdier it belongs to was added. 71 72 ## Database setup for development 73 74 You can install Postgres on your machine or use an existing installation. 75 76 Or you could use docker like this: 77 78 ```docker 79 docker run -d \\ 80 --name c2ec-db-dev \\ 81 -p 5432:5432 \\ 82 -e POSTGRES_PASSWORD=[PW] \\ 83 -e POSTGRES_USER=[USERNAME] \\ 84 postgres:latest 85 ``` 86 87 Access running Postgres-Container using: 88 89 ```docker 90 docker exec -it c2ec-db-dev /bin/bash 91 92 # to access your database using psql first change the user 93 su postgres 94 95 # run psql and define the user from the docker run command to login 96 psql -U local 97 ``` 98 99 Then create a database using: 100 101 ```sql 102 CREATE DATABASE {DB_NAME} [WITH OWNER {USERNAME}]; 103 ``` 104 105 Make sure to setup the database using the `migrate.sh` script in the `db` subdir: 106 107 ``` 108 ./migrate.sh {DB_USERNAME} {DB_PASSWORD} {DB_NAME} {ADMIN_PW} {OPERATOR_PW} {API_PW} 109 ``` 110 111 Later when manually manipulating or plumbing the database by hand make sure to also define the database when using psql 112 113 ```bash 114 psql -U {username} -d {database} 115 ```