TRP
The Transaction Resolve Protocol endpoint for tx3, hosted by Demeter.
What it is for
Resolving tx3 transactions: you send a compiled tx3 transaction and its
arguments, and TRP picks the inputs, balances it and returns the transaction
to sign. It also submits signed transactions and reports their status. The
trix toolchain and the tx3-sdk TypeScript client speak it.
For tx3 itself, see the tx3 documentation.
Hosts
The pattern, where {network} is cardano-mainnet, cardano-preprod or
cardano-preview:
https://{network}.trp-m1.demeter.run
On preprod:
https://cardano-preprod.trp-m1.demeter.run
It is JSON-RPC over HTTP: POST to the host root. There is no authenticated
host form.
Authentication
Send the key in the dmtr-api-key header:
dmtr-api-key: <your key>
Networks
cardano-mainnet, cardano-preprod and cardano-preview. Each port serves
one network, chosen when you create it.
Limits
TRP runs on the Free tier on mainnet, preprod and preview. Its paid tiers are not published yet.
Getting a key
Create a TRP port at https://console.demeter.run. The port's page shows its
endpoint and its API key.
Example
Set the key in your shell:
export DEMETER_API_KEY=... # the API key from the port's page
With curl, ask for the status of a list of transaction hashes (empty here),
which proves the endpoint and key work:
curl -H "dmtr-api-key: $DEMETER_API_KEY" -H "content-type: application/json" \
-d '{"jsonrpc":"2.0","id":1,"method":"trp.checkStatus","params":{"hashes":[]}}' \
https://cardano-preprod.trp-m1.demeter.run
A trix profile
trix reads its TRP endpoint from the network a profile names. Declare a
network that points at your port, then a profile that uses it (checked
against trix 0.28). A network also needs a UTxO RPC endpoint, which can be a
UTxO RPC port of your own. trix.toml does not expand
environment variables, so the keys are written into the file: do not commit
it with them.
[networks.demeter-preprod]
is_testnet = true
[networks.demeter-preprod.trp]
url = "https://cardano-preprod.trp-m1.demeter.run"
headers = { "dmtr-api-key" = "<your TRP key>" }
[networks.demeter-preprod.u5c]
url = "https://cardano-preprod.utxorpc-m1.demeter.run"
headers = { "dmtr-api-key" = "<your UTxO RPC key>" }
[profiles.preprod]
network = "demeter-preprod"
Then trix invoke -p preprod resolves through your port.
tx3-sdk
TrpClient takes the endpoint and headers. The same options go to a protocol
client through Tx3ClientBuilder.trp() (checked against tx3-sdk 0.15.0):
import { Protocol, TrpClient } from "tx3-sdk";
const trp = {
endpoint: "https://cardano-preprod.trp-m1.demeter.run",
headers: { "dmtr-api-key": process.env.DEMETER_API_KEY! },
};
// One request on its own: the status of no transactions.
console.log(await new TrpClient(trp).checkStatus([]));
// With a compiled protocol: TII_PATH is the .tii file `trix build` writes.
const protocol = await Protocol.fromFile(process.env.TII_PATH!);
const client = protocol.client().trp(trp).build();