Documentation
uftp implements UFTP 3.1, the USEF Flex Trading Protocol, in Rust. UFTP is maintained by LF Energy as Shapeshifter. The crate covers the 26 messages, their XML and signatures, the rules a receiver must apply, and the order to apply them in. It does no I/O of its own: you bring the clock, the ids, the keys and the network.
- New to the protocol? Read What UFTP is.
- Want code running? Start with Getting started.
- Writing an endpoint? Read Receiving, then Sending.
- Connecting to a party that runs LF Energy's Java library? Read Interoperability first. It lists what that library refuses that it should not.
Everything in this section
- Getting started — Add uftp, build a signed FlexRequest, receive it with an Endpoint, and answer it, in one short Rust program.
- What UFTP is — The USEF Flex Trading Protocol in ten minutes: DSOs, aggregators and the CRO, congestion points, ISPs, the request–offer–order–settlement cycle, signing and transport.
- Messages — All 26 UFTP 3.1 message types in uftp: who sends them, constructors with the specification's defaults, replies, typed access and the offer and order builders.
- Receiving — How a uftp receiver verifies, decodes and checks a UFTP message: the two ways to say no, the Endpoint pipeline, HTTP handlers, the outbox and replay protection.
- Sending — Seal a UFTP message, POST it with the http crate types, and decide from the status whether it was delivered, should be retried or has failed.
- Settling — The settle phase: the DSO builds a FlexSettlement from its orders, the aggregator checks every item against the orders it accepted and answers Accepted or Disputed.
- ISPs, markets and time — DST-correct ISP arithmetic in uftp: day grids of 92, 96 or 100 quarter-hours, market checks for ISP length and time zone, and the time rules of UFTP §3.5.
- Rejections — Every refusal in uftp: the 38 rejection reasons of UFTP §3.5 and the use cases, where each is defined, and refusal texts that are safe to log and send back.
- Keys and discovery — How uftp finds a sender's CS1 public key: a static Directory for configured deployments, the DNS records of UFTP Appendix 4, and key rollover with two keys.
- Security — What uftp verifies before it parses, how it bounds untrusted input, and what is left to your deployment: keys, TLS, DNSSEC and authorisation.
- Interoperability — uftp tested against LF Energy's shapeshifter-core 3.7.0: what both accept, the reference library's known bugs, and what to do when your counterpart runs it.
- Specification notes — Where the UFTP 3.1.0 XSDs, the specification text and the reference library disagree, and what uftp does in each case.
- How it is tested — The checks behind uftp: independent voters for XML and signatures, property tests, fuzzing, mutation testing, refusal snapshots and the Shapeshifter differential.