@raycashxyz/mpp
v0.1.2
Published
Private machine-to-machine payments for the [Machine Payments Protocol](https://mpp.dev), powered by [Raycash](https://raycash.xyz).
Readme
@raycashxyz/mpp
Private machine-to-machine payments for the Machine Payments Protocol, powered by Raycash.
AI agents pay for API services through payment channels where settlement exits through an FHE-encrypted token wrapper — the recipient's identity is hidden on-chain.
Install
npm install @raycashxyz/mppServer (Operator)
Add payment verification to any HTTP endpoint:
import { raycash } from "@raycashxyz/mpp/server";
import { Mppx } from "mppx/hono"; // or mppx/express, etc.
const mppx = Mppx.create({
secretKey: process.env.MPP_SECRET_KEY,
methods: [
raycash({
currency: "0x...", // ERC-20 token address
chainId: 11155111, // Sepolia
minDeposit: "100000", // 0.1 USDC
serviceUrl: "https://my-api.com",
raycashBaseUrl: "https://raycash.xyz",
apiKey: process.env.RAYCASH_API_KEY,
}),
],
});
app.get("/data", mppx.channel({ amount: "1000" }), (c) => {
return c.json({ result: "paid data" });
});Client (Agent)
Make paid requests with automatic channel management:
import { raycash } from "@raycashxyz/mpp/client";
import { Method } from "mppx";
const client = Method.toClient(raycashChannel, raycash({
account: walletAccount,
onFundChannel: async ({ channelAddress, minDeposit }) => {
// Send tokens to the channel address
},
}));How It Works
- Agent requests a resource → service returns
402with pricing - Agent signs an EIP-712 voucher authorizing payment
- Agent retries with the voucher → service verifies via Raycash → serves data
- Operator settles vouchers on-chain → funds enter the confidential wrapper
- Recipient identity stays encrypted (FHE) — observers can't link payments to operators
Links
- Raycash Dashboard — create apps, manage channels, settle payments
- MPP Protocol — the open standard for machine payments
- Whitepaper
License
MIT
