summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAntoine A <>2022-03-03 14:27:31 +0100
committerAntoine A <>2022-03-03 14:27:31 +0100
commit1e93728aebe96095dde1848e303f07fe9a22daf6 (patch)
treed9fde97fa49061512ff806424ee3eb2bf9c2ee27
parentee9c60847a8e4aa7daecb588c2f723b6bf272fe6 (diff)
downloaddepolymerization-1e93728aebe96095dde1848e303f07fe9a22daf6.tar.gz
depolymerization-1e93728aebe96095dde1848e303f07fe9a22daf6.tar.bz2
depolymerization-1e93728aebe96095dde1848e303f07fe9a22daf6.zip
Improve documentation
-rw-r--r--.gitignore1
-rw-r--r--Cargo.lock43
-rw-r--r--README.md142
-rw-r--r--btc-wire/README.md59
-rw-r--r--docs/taler-btc.conf17
-rw-r--r--docs/taler-eth.conf17
-rw-r--r--eth-wire/README.md38
-rw-r--r--instrumentation/Cargo.toml3
8 files changed, 200 insertions, 120 deletions
diff --git a/.gitignore b/.gitignore
index 321b957..89a34eb 100644
--- a/.gitignore
+++ b/.gitignore
@@ -4,6 +4,7 @@ log
/docs/*
!/docs/*.docx
!/docs/*.tex
+!/docs/*.conf
!/docs/media
/tmp
taler.conf \ No newline at end of file
diff --git a/Cargo.lock b/Cargo.lock
index 4ddd828..6f63bc9 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -124,7 +124,7 @@ dependencies = [
"base64",
"bech32",
"bitcoin",
- "clap 3.1.3",
+ "clap 3.1.5",
"common",
"criterion",
"hex",
@@ -206,9 +206,9 @@ dependencies = [
[[package]]
name = "clap"
-version = "3.1.3"
+version = "3.1.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "86f8c0e2a6b902acc18214e24a6935cdaf8a8e34231913d4404dcaee659f65a1"
+checksum = "ced1892c55c910c1219e98d6fc8d71f6bddba7905866ce740066d8bfea859312"
dependencies = [
"atty",
"bitflags",
@@ -218,14 +218,14 @@ dependencies = [
"os_str_bytes",
"strsim",
"termcolor",
- "textwrap 0.14.2",
+ "textwrap 0.15.0",
]
[[package]]
name = "clap_derive"
-version = "3.1.2"
+version = "3.1.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "01d42c94ce7c2252681b5fed4d3627cc807b13dfc033246bd05d5b252399000e"
+checksum = "da95d038ede1a964ce99f49cbe27a7fb538d1da595e4b4f70b8c8f338d17bf16"
dependencies = [
"heck",
"proc-macro-error",
@@ -235,6 +235,16 @@ dependencies = [
]
[[package]]
+name = "clap_mangen"
+version = "0.1.2"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "0649fb4156bbd7306896025005596033879a2051f9a3aa7416ab915df1f8fdac"
+dependencies = [
+ "clap 3.1.5",
+ "roff",
+]
+
+[[package]]
name = "common"
version = "0.1.0"
dependencies = [
@@ -497,7 +507,7 @@ dependencies = [
name = "eth-wire"
version = "0.1.0"
dependencies = [
- "clap 3.1.3",
+ "clap 3.1.5",
"common",
"ethereum-types",
"hex",
@@ -890,7 +900,8 @@ version = "0.1.0"
dependencies = [
"bitcoin",
"btc-wire",
- "clap 3.1.3",
+ "clap 3.1.5",
+ "clap_mangen",
"common",
"eth-wire",
"ethereum-types",
@@ -1454,6 +1465,12 @@ dependencies = [
]
[[package]]
+name = "roff"
+version = "0.2.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "b833d8d034ea094b1ea68aa6d5c740e0d04bad9d16568d08ba6f76823a114316"
+
+[[package]]
name = "rust-ini"
version = "0.17.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -1725,9 +1742,9 @@ dependencies = [
[[package]]
name = "termcolor"
-version = "1.1.2"
+version = "1.1.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "2dfed899f0eb03f32ee8c6a0aabdb8a7949659e3466561fc0adf54e26d88c5f4"
+checksum = "bab24d30b911b2376f3a13cc2cd443142f0c81dda04c118693e35b3835757755"
dependencies = [
"winapi-util",
]
@@ -1743,9 +1760,9 @@ dependencies = [
[[package]]
name = "textwrap"
-version = "0.14.2"
+version = "0.15.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "0066c8d12af8b5acd21e00547c3797fde4e8677254a7ee429176ccebbe93dd80"
+checksum = "b1141d4d61095b28419e22cb0bbf02755f5e54e0526f97f1e3d1d160e60885fb"
[[package]]
name = "thiserror"
@@ -2171,7 +2188,7 @@ name = "wire-gateway"
version = "0.1.0"
dependencies = [
"bitcoin",
- "clap 3.1.3",
+ "clap 3.1.5",
"common",
"deadpool-postgres",
"ethereum-types",
diff --git a/README.md b/README.md
index bd43817..8528763 100644
--- a/README.md
+++ b/README.md
@@ -2,41 +2,102 @@
## Project structure
-- **wire-gateway**: [Taler Wire Gateway HTTP API](https://docs.taler.net/core/api-wire.html) server
-- **btc-wire**: Taler wire implementation for [bitcoincore](https://bitcoincore.org/en/about/) node
-- **eth-wire**: Taler wire implementation for [go-ethereum](https://geth.ethereum.org/) node
+- **wire-gateway**:
+ [Taler Wire Gateway HTTP API](https://docs.taler.net/core/api-wire.html)
+ server
+- **btc-wire**: Taler wire implementation for
+ [bitcoincore](https://bitcoincore.org/en/about/) node
+- **eth-wire**: Taler wire implementation for
+ [go-ethereum](https://geth.ethereum.org/) node
- **uri-pack**: Efficient probabilistic binary encoding for URI
+- **db**: Database schemas
- **docs**: Documentation files
- **test**: Test scripts
+- **instrumentation**: Instrumentation test tool
-## Install
+## Install from source
+
+Cargo version 1.16.1 or above is required. You can get cargo from your
+distribution package manager or from [rustup.rs](https://rustup.rs/).
```
+git clone https://git.taler.net/depolymerization.git/
+cd depolymerization
make install
```
-Read adapter specific documentation to run depolymerizer:
+To also install test tools run: `make install_test`.
-- [BTC](btc-wire/README.md)
-- [ETH](eth-wire/README.md)
+## Configuration
+The configuration is based on
+[taler.conf](https://docs.taler.net/manpages/taler.conf.5.html).
-## Configuration
+You can find filled configurations for each implementation:
-The configuration is based on [taler.conf](https://docs.taler.net/manpages/taler.conf.5.html).
+- [btc-wire](docs/taler-btc.conf)
+- [eth-wire](docs/taler-eth.conf)
+
+### Initialization
This is the minimal required config for initialization.
-``` ini
-# taler.conf - required config (fill all ___)
+```ini
+# taler.conf - (fill all ___)
[taler]
-CURRENCY = ___
+# Exchange currency
+CURRENCY = ___
[exchange]
-BASE_URL = https://___
+# Exchange base url
+BASE_URL = ___
+
+[depolymerizer-___]
+# Postgres connection URL
+DB_URL = ___
+# Wire payto URL
+# PAYTO = ___
+```
+
+`PAYTO` is to be added after wallet initialization.
+
+### btc-wire
+
+btc-wire will automatically read the bitcoin configuration file to connect to
+the RPC server. Two flags are mandatory:
+
+- `txindex=1`: btc-wire need access to transaction not linked to the wire wallet
+- `maxtxfee=?`: bitcoin transactions fees can exceed taler wire fees, putting
+ your wire in bankruptcy. You must specify an acceptable transaction fee cap.
+
+```ini
+[depolymerizer-bitcoin]
+# TODO
+DATA_DIR = TODO
+# Number of blocks to consider a transactions durable
+CONFIRMATION = 6
+# Amount to keep when bouncing malformed credit
+BOUNCE_FEE = BTC:0.00001
+```
+
+### eth-wire
+
+```ini
+[depolymerizer-bitcoin]
+# TODO
+DATA_DIR = TODO
+# Number of blocks to consider a transactions durable
+CONFIRMATION = 24
+# Amount to keep when bouncing malformed credit
+BOUNCE_FEE = ETH:0.00001
+```
+
+### Wire gateway
+```ini
[depolymerizer-___]
-DB_URL = postgres://___
+PORT = 8080
+UNIXPATH =
```
### Process lifetime
@@ -46,7 +107,7 @@ stability (ex. fix memory fragmentation). It is possible to configure lifetime
that trigger graceful shutdown every time a specific amount of work have been
done.
-``` ini
+```ini
[depolymerizer-___]
# Number of requests to serve before gateway shutdown (0 mean never)
HTTP_LIFETIME = 0
@@ -58,24 +119,47 @@ WIRE_LIFETIME = 0
When a transaction is sent with a fee too small compared to other transaction,
it can take an unlimited amount of time for this transaction to be mined. It is
-possible to replace this transaction with another transaction with more fees.
+possible to replace this transaction with another transaction with more fees.
Depolymerizer can be configured to do this automatically:
-``` ini
+```ini
[depolymerizer-___]
# Delay in seconds before bumping an unconfirmed transaction fee (0 mean never)
BUMP_DELAY = 0
```
-Modules have specific configuration:
+## Getting started
+
+#### btc-wire
-- [wire-gateway](wire-gateway/README.md#Configuration)
-- [btc-wire](btc-wire/README.md#Configuration)
+[Bitcoind](https://bitcoincore.org/) version 22.\* is required
+
+1. Write configuration files
+2. Start bitcoind
+3. Start PostgreSQL
+4. Initialize database `btc-wire initdb`
+5. Initialize wallet `btc-wire initwallet`
+6. Update configuration files with wallet info
+7. Run wire-gateway `wire-gateway`
+8. Run btc-wire `btc-wire`
+
+#### eth-wire
+
+[Geth](https://geth.ethereum.org/) version 1.10.\* is required
+
+1. Write configuration files
+2. Start geth
+3. Start PostgreSQL
+4. Initialize database `eth-wire initdb`
+5. Initialize wallet `eth-wire initwallet`
+6. Update configuration files with wallet info
+7. Run wire-gateway `wire-gateway`
+8. Run eth-wire `eth-wire`
## Security
-Depolymerizer only use encrypted wallet, and provide an easy way to create
-them. However, it is the administrator responsibility to backup its wallet and
+Depolymerizer only use encrypted wallet, and provide an easy way to create them.
+However, it is the administrator responsibility to backup its wallet and
password.
Only the wire adapter need to have the password stored in its environnement.
@@ -83,16 +167,18 @@ Only the wire adapter need to have the password stored in its environnement.
## Test
The following binaries need to be in the local user PATH:
+
- `pg_ctl` and `psql` from PostgreSQL
- `geth` from [go-ethereum](https://geth.ethereum.org/downloads/)
-- `bitcoind` and `bitcoin-cli` from [bitcoincore](https://bitcoincore.org/en/download/)
-- `taler-config` and `taler-exchange-wire-gateway-client` from the
-[Taler exchange repository](https://git.taler.net/exchange.git/)
+- `bitcoind` and `bitcoin-cli` from
+ [bitcoincore](https://bitcoincore.org/en/download/)
+- `taler-config` and `taler-exchange-wire-gateway-client` from the
+ [Taler exchange repository](https://git.taler.net/exchange.git/)
You can use the [prepare](script/prepare.sh) script to downloads and extract
-blockchain binaries and find the path of the local postgres
-installation. However taler binaries need to be compiled from source for now.
+blockchain binaries and find the path of the local postgres installation.
+However taler binaries need to be compiled from source for now.
```
make test
-``` \ No newline at end of file
+```
diff --git a/btc-wire/README.md b/btc-wire/README.md
index d9d7a95..c887fd4 100644
--- a/btc-wire/README.md
+++ b/btc-wire/README.md
@@ -1,44 +1,7 @@
# btc-wire
-btc-wire is taler wire adapter for [bitcoincore](https://bitcoincore.org/en/about/) node
-
-## Bitcoincore compatibility
-
-Bitcoind version 22.* is required
-
-## Install
-
-`cargo install --path btc-wire`
-
-## Configuration
-
-### taler.conf
-
-The configuration is based on [taler.conf](https://docs.taler.net/manpages/taler.conf.5.html)
-
-``` ini
-# taler.conf - btc-wire default config
-[depolymerizer-bitcoin]
-DATA_DIR =
-CONFIRMATION = 6
-BOUNCE_FEE = BTC:0.00001
-```
-
-### bitcoin.conf
-
-btc-wire will automatically read the bitcoin configuration file to connect to
-the RPC server, `txindex=1` and `maxtxfee` are mandatory.
-
-## Getting Started
-
-1. Write configuration files
-2. Start bitcoind
-3. Start PostgreSQL
-4. Initialize database `btc-wire initdb`
-5. Initialize wallet `btc-wire initwallet`
-6. Update configuration files with wallet info
-7. Run wire-gateway `wire-gateway`
-8. Run btc-wire `btc-wire`
+btc-wire is taler wire adapter for
+[bitcoincore](https://bitcoincore.org/en/about/) node
## Deposit metadata format
@@ -47,17 +10,17 @@ addresses to encode the reserve public key as metadata into a common bitcoin
transaction.
A single segwit address can contain 20B of chosen data and the reserve pub key
-is 32B. We use two fake adresses consisting of the two key half prepended
-with the same random pattern, at the exception of the first bit with must be 0
-for the first half and 1 for the second one. You must then send a single
-transaction with the three addresses as recipients.
+is 32B. We use two fake adresses consisting of the two key half prepended with
+the same random pattern, at the exception of the first bit with must be 0 for
+the first half and 1 for the second one. You must then send a single transaction
+with the three addresses as recipients.
-Segwit addresses are encoded using a bitcoin specific format:
+Segwit addresses are encoded using a bitcoin specific format:
[bech32](https://github.com/bitcoin/bips/blob/master/bip-0173.mediawiki)
As a few lines of code can carry more meaning that many words, you can find a
[simple rust example](src/bin/segwit-demo.rs) in this project and run it with
-`make segwit_demo`.
+`make segwit_demo`.
```
Ⅰ - Parse payto uri
@@ -100,5 +63,7 @@ Make sure the amount show 0.10000588 BTC, else you have to change the base unit
### Stuck transaction
-We resolve stuck transaction by always sending replaceable transaction
-using [BIP 125](https://github.com/bitcoin/bips/blob/master/bip-0125.mediawiki). \ No newline at end of file
+We resolve stuck transaction by always sending replaceable transaction using
+[BIP 125](https://github.com/bitcoin/bips/blob/master/bip-0125.mediawiki).
+
+TODO
diff --git a/docs/taler-btc.conf b/docs/taler-btc.conf
new file mode 100644
index 0000000..0c18e4b
--- /dev/null
+++ b/docs/taler-btc.conf
@@ -0,0 +1,17 @@
+# Full btc-wire configuration
+[taler]
+CURRENCY = BTC
+
+[exchange]
+BASE_URL = http://test.com
+
+[depolymerizer-bitcoin]
+DB_URL = postgres://%2Fvar%2Frun%2Fpostgresql/btc-wire
+PAYTO = payto://bitcoin/bc1qcr40fzphnh4mcwlv65kvdam4dxq977t2rn54qx
+PORT = 8080
+DATA_DIR = ~/.bitcoin
+CONFIRMATION = 6
+BOUNCE_FEE = BTC:0.00001
+HTTP_LIFETIME = 0
+WIRE_LIFETIME = 0
+BUMP_DELAY = 0
diff --git a/docs/taler-eth.conf b/docs/taler-eth.conf
new file mode 100644
index 0000000..7cee080
--- /dev/null
+++ b/docs/taler-eth.conf
@@ -0,0 +1,17 @@
+# Full eth-wire configuration
+[taler]
+CURRENCY = ETH
+
+[exchange]
+BASE_URL = http://test.com
+
+[depolymerizer-ethereum]
+DB_URL = postgres://%2Fvar%2Frun%2Fpostgresql/eth-wire
+PAYTO = payto://ethereum/425870d7b77ad5665ca982ff85c398222a70fe7c
+PORT = 8080
+DATA_DIR = ~/.ethereum/get/geth.ipc
+CONFIRMATION = 24
+BOUNCE_FEE = ETH:0.00001
+HTTP_LIFETIME = 0
+WIRE_LIFETIME = 0
+BUMP_DELAY = 0
diff --git a/eth-wire/README.md b/eth-wire/README.md
index 7e1f6ec..e15a062 100644
--- a/eth-wire/README.md
+++ b/eth-wire/README.md
@@ -1,38 +1,12 @@
# eth-wire
-eth-wire is taler wire adapter for [go-ethereum](https://geth.ethereum.org/) node
+eth-wire is taler wire adapter for [go-ethereum](https://geth.ethereum.org/)
+node
-## Geth compatibility
+## Deposit metadata format
-Geth version 1.10.* is required
-
-## Install
-
-`cargo install --path eth-wire`
-
-## Configuration
-
-### taler.conf
-
-The configuration is based on [taler.conf](https://docs.taler.net/manpages/taler.conf.5.html)
-
-``` ini
-# taler.conf - eth-wire default config
-[depolymerizer-ethereum]
-DATA_DIR =
-CONFIRMATION = 24
-BOUNCE_FEE = ETH:0.00001
-```
-
-## Getting Started
-
-1. Write configuration files
-2. Start geth
-3. Start PostgreSQL
-4. Initialize database `eth-wire initdb`
-5. Initialize wallet `eth-wire initwallet`
-6. Update configuration files with wallet info
-7. Run wire-gateway `wire-gateway`
-8. Run eth-wire `eth-wire`
+TODO
## Implementation details
+
+TODO \ No newline at end of file
diff --git a/instrumentation/Cargo.toml b/instrumentation/Cargo.toml
index 76365a8..58cbce8 100644
--- a/instrumentation/Cargo.toml
+++ b/instrumentation/Cargo.toml
@@ -18,3 +18,6 @@ ethereum-types = { version = "0.13.0", default-features = false }
hex = "0.4.3"
# Wire Gateway
ureq = { version = "2.4.0", features = ["json"] }
+
+[build-dependencies]
+clap_mangen = "0.1"