Skip to content

Commit

Permalink
Add setup section for relay/transaction service (#27)
Browse files Browse the repository at this point in the history
* Add setup section for relay service
* Add setup section for transaction service
* Fix typos
  • Loading branch information
Uxio0 committed Feb 17, 2020
1 parent d1441b6 commit 5caedc0
Show file tree
Hide file tree
Showing 3 changed files with 94 additions and 6 deletions.
4 changes: 2 additions & 2 deletions source/services/notifications.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ Note: The QR is a stringified object.
The mobile app can scan the QR code and use the message to add itself as authorized device. It is then allowed to send push notifications to the chrome extension.


## Endpoints
## API Endpoints
### v2/auth/ POST
#### Pre-requirements:
* Generate local private key
Expand All @@ -65,7 +65,7 @@ The mobile app can scan the QR code and use the message to add itself as authori
}
```
#### Response
If no previous owner exists, we create a new entry with push token and owner param
If no previous owner exists, we create a new entry with push token and owner parameter.
Otherwise, update current Device entry.

> Returns HTTP 201 if OK
Expand Down
50 changes: 46 additions & 4 deletions source/services/relay.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Relay Service
This service allows us to have owners of the Safe contract that don’t need to hold any ETH on those owner addresses. How is this possible? The transaction relay service acts as a proxy, paying for the transaction fees and getting it back due to the transaction architecture we use.
This service allows us to have owners of the Safe contract that don’t need to hold any ETH on those owner addresses. How is this possible? The transaction relay service acts as a proxy, paying for the transaction fees and getting it back due to the transaction architecture we use. It also enables the user to pay for ethereum transactions using **ERC20 tokens**.

Our target user hold crypto in a centralized exchange (or on another Ethereum address) and wants to move it to a secure account. We don’t want the user to trust us, for moving the funds and deploying the smart contract on their behalf. We on the other side want to prevent users from spamming our services, there shouldn't be a need to trust the user either. The process for this is descriped in the [contracts deployment section](../contracts/deployment.html).
Our target user hold crypto in a centralized exchange (or on another Ethereum address) and wants to move it to a secure account. We don’t want the user to trust us, for moving the funds and deploying the smart contract on their behalf. We on the other side want to prevent users from spamming our services, there shouldn't be a need to trust the user either. The process for this is described in the [contracts deployment section](../contracts/deployment.html).

[GitHub](https://github.com/gnosis/safe-relay-service)

Expand All @@ -13,6 +13,47 @@ Our target user hold crypto in a centralized exchange (or on another Ethereum ad

[Safe Contracts and addresses on networks](https://github.com/gnosis/safe-contracts/releases)

## Setup
### For development (using ganache)
This is the recommended configuration for developing and testing the Relay service. `docker-compose` is required for running the project.

Configure the parameters needed on `.env_ganache`. By default the private keys of the accounts are the ones from
Ganache, and the contract addresses are calculated to be the ones deployed by the Relay when the application starts,
so there's no need to configure anything.

More parameters can be added to that file like:
- `SAFE_FIXED_CREATION_COST`: For fixed price in wei for deploying a Safe. If you set `0` you allow Safes to be
deployed for free.
- `SAFE_CONTRACT_ADDRESS` to change the Safe's master copy address.
- For more parameters check `base.py` file.

Then:
```bash
docker-compose -f docker-compose.yml -f docker-compose.dev.yml build --force-rm
docker-compose -f docker-compose.yml -f docker-compose.dev.yml up
```

### For production
This is the recommended configuration for running a production Relay. `docker-compose` is required
for running the project.

Configure the parameters needed on `.env`. These parameters **need to be changed**:
- `ETHEREUM_NODE_URL`: Http/s address of a ethereum node.
- `SAFE_FUNDER_PRIVATE_KEY`: Use a private key for an account with ether on that network. It's used to deploy new Safes.
- `SAFE_TX_SENDER_PRIVATE_KEY`: Same as the `SAFE_FUNDER_PRIVATE_KEY`, but it's used to relay all transactions.

Another parameters can be configured like:
- `SAFE_CONTRACT_ADDRESS`: If you are not using default Gnosis Safe Master Copy.
- `SAFE_FIXED_CREATION_COST`: For fixed price in wei for deploying a Safe. If you set `0` you allow Safes to be
deployed for free
- For more parameters check `base.py` file.

Then:
```bash
docker-compose build --force-rm
docker-compose up
```

## Flows

### Safe creation old flowchart (without CREATE2, deprecated)
Expand Down Expand Up @@ -239,14 +280,15 @@ Allows to send and pay transactions via the Transaction Relay Service. The Safe
```

**Note:** Atomic operation.

---
## /api/v1/tokens/ GET
### /api/v1/tokens/ GET
Returns a paginated list of tokens. Each token has the ERC20 information (address, name, symbol, decimals) and if available additional meta information to the token (icon, website ...). Furthermore tokens can be marked to be shown to the user by `default`.

### Notes:
* Currently token info is retrieved from [etherscan](https://etherscan.io/tokens)

### Query params:
### Query parameters:
Besides pagination:
* `search`: Search words in `name`, `symbol` and `description`.
* `name`, `symbol` and `address`: Do an exact filtering based on that parameters.
Expand Down
46 changes: 46 additions & 0 deletions source/services/transactions.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,52 @@ previous versions of the *Transaction Service*

[Safe Contracts and addresses on networks](https://github.com/gnosis/safe-contracts/releases)

## Setup
This is the recommended configuration for running a production Transaction service. `docker-compose` is required
for running the project.

Configure the parameters needed on `.env`. These parameters **need to be changed**:
- `ETHEREUM_NODE_URL`: Http/s address of a ethereum node. It can be the same than `ETHEREUM_TRACING_NODE_URL`.
- `ETHEREUM_TRACING_NODE_URL`: Http/s address of a Ethereum Parity node with
[tracing enabled](https://wiki.parity.io/JSONRPC-trace-module).

If you need the Usd conversion for tokens don't forget to configure:
- `ETH_UNISWAP_FACTORY_ADDRESS`: Checksummed address of Uniswap Factory contract.
- `ETH_KYBER_NETWORK_PROXY_ADDRESS`: Checksummed address of Kyber Network Proxy contract.

For more parameters check `base.py` file.

Then:
```bash
docker-compose build --force-rm
docker-compose up
```

The service should be running in `localhost:8000`. You can test everything is set up:

```bash
curl 'http://localhost:8000/api/v1/about/'
```

For example, to set up a Göerli node:

Run a Parity node in your local computer:
```bash
parity --chain goerli --tracing on --db-path=/media/ethereum/parity --unsafe-expose
```

Edit `.env` so docker points to he host Parity:
```
ETHEREUM_NODE_URL=http://172.17.0.1:8545
ETHEREUM_TRACING_NODE_URL=http://172.17.0.1:8545
```

Then:
```bash
docker-compose build --force-rm
docker-compose up
```

## API Endpoints

---
Expand Down

0 comments on commit 5caedc0

Please sign in to comment.