Skip to content

Commit e4cbbb3

Browse files
authored
docs(readme): initial usage documentation (#184)
Signed-off-by: Chris Gianelloni <[email protected]>
1 parent 97dd488 commit e4cbbb3

File tree

1 file changed

+104
-1
lines changed

1 file changed

+104
-1
lines changed

README.md

Lines changed: 104 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,105 @@
11
# tx-submit-api-mirror
2-
Simple cardano-submit-api look-alike that mirrors requests asynchronously to configured backends
2+
3+
A simple Cardano transaction submission API service which mirrors all incoming
4+
requests asynchronously to configured backend submission API services.
5+
6+
A simple HTTP API which accepts a CBOR encoded Cardano transaction as a
7+
payload body and submits it to one or more configured backend transaction
8+
submission API services.
9+
10+
## Usage
11+
12+
The recommended method of using this application is via the published
13+
container images or application binaries.
14+
15+
Docker:
16+
```
17+
docker run -e BACKENDS=http://tx1,http://tx2 -p 8090:8090 ghcr.io/blinklabs-io/tx-submit-api-mirror
18+
docker run -d \
19+
-e BACKENDS=http://tx1/api/submit/tx,https://tx2,http://tx3:8090 \
20+
-p 8080:8080 \
21+
ghcr.io/blinklabs-io/tx-submit-api-mirror
22+
```
23+
24+
Binaries can be executed directly and are available from
25+
[Releases](https://github.com/blinklabs-io/tx-submit-api-mirror/releases).
26+
27+
```
28+
BACKENDS=http://tx1,http://tx2 ./tx-submit-api-mirror
29+
```
30+
31+
### Configuration
32+
33+
Configuration can be done using either a `config.yaml` file or setting
34+
environment variables. Our recommendation is environment variables to adhere
35+
to the 12-factor application philisophy.
36+
37+
#### Environment variables
38+
39+
Configuration via environment variables can be broken into two sets of
40+
variables. The first set controls the behavior of the application, while the
41+
second set controls the connection to the backend submission APIs.
42+
43+
Application configuration:
44+
- `API_LISTEN_ADDRESS` - Address to bind for API calls, all addresses if empty
45+
(default: empty)
46+
- `API_LISTEN_PORT` - Port to bind for API calls (default: 8090)
47+
- `CLIENT_TIMEOUT` - Timeout for async HTTP operations (default: 60000)
48+
- `LOGGING_LEVEL` - Logging level for log output (default: info)
49+
- `TLS_CERT_FILE_PATH` - SSL certificate to use, requires `TLS_KEY_FILE_PATH`
50+
(default: empty)
51+
- `TLS_KEY_FILE_PATH` - SSL certificate key to use (default: empty)
52+
53+
Connection to the backends can be configured using general HTTP Cardano
54+
transaction submission APIs or using infrastructure providers with a
55+
transaction submission endpoint. All requests are sent async and non-blocking.
56+
57+
Backends configuration:
58+
- `BACKENDS` - Comma separated list of HTTP Cardano transaction submission
59+
service API URIs
60+
61+
Maestro configuration:
62+
- `MAESTRO_API_KEY` - API key to a Cardano project on Maestro
63+
- `MAESTRO_NETWORK` - Named Cardano network to use (default: mainnet)
64+
- `MAESTRO_TURBO_TX` - Enable use of Maestro TurboTx for transaction submission
65+
(default: false)
66+
67+
Connection to Maestro can be performed using specific named network shortcuts
68+
for known network magic configurations. Supported named networks are:
69+
70+
- mainnet
71+
- preprod
72+
- preview
73+
74+
### Sending transactions
75+
76+
This implementation shares an API spec with IOHK's Haskell implementation. The
77+
same instructions apply. Follow the steps to
78+
[build and submit a transaction](https://github.com/input-output-hk/cardano-node/tree/master/cardano-submit-api#build-and-submit-a-transaction)
79+
80+
```
81+
# Submit a binary tx.signed.cbor signed CBOR encoded transaction binary file
82+
curl -X POST \
83+
--header "Content-Type: application/cbor" \
84+
--data-binary @tx.signed.cbor \
85+
http://localhost:8090/api/submit/tx
86+
```
87+
88+
## Development
89+
90+
There is a Makefile to provide some simple helpers.
91+
92+
Run from checkout:
93+
```
94+
go run .
95+
```
96+
97+
Create a binary:
98+
```
99+
make
100+
```
101+
102+
Create a docker image:
103+
```
104+
make image
105+
```

0 commit comments

Comments
 (0)