Signed Request

Last updated 6 months ago

Why do we need signed request?

When dealing with B2B invoices, you especially need to broadcast your transaction on the blockchain so that your client can detect it automatically. But when you are at a Point of Sale or an online store, the vendor doesn’t need to broadcast the invoice on the blockchain. If he did so, the buyer would have to wait for blockchain confirmation and it would add a gas cost as the process would need 2 transactions on the blockchain.

The regular workflow for a request

The solution to bypass the invoice broadcasting is to work on an ECDSA optimization where the seller encrypts his transaction, provides it to the client who accepts the invoice, pays it and broadcasts it in a single transaction. Most blockchain systems (including Ethereum and Bitcoin) use the Elliptic Curve Digital Signature Algorithm (ECDSA) for cryptographically signing transactions. We use it to prove that the sender of the transaction had access to a private key and that the transaction has not been changed since it was signed.

The workflow for a signed request

In the signed request workflow, only one Ethereum transaction is needed:

  1. The payee creates a signed request. (see how to do it below)

  2. The payee shares the signed request to the payer.

  3. From this point, the payer can create the request on behalf of the payee. It can also accept and pay it in only one transaction.

  4. The payee can scan the Ethereum blockchain to detect when the signed request is broadcasted.

The signed request object

A signed request is a json object containing all the information needed to create a request plus the signature of the creator:

"currencyContract": "Address of the currency contract",
"data": "hash of the ipfs file(optional)",
"expectedAmounts": "amount initial expected per payees for the request",
"expirationDate": "unix timestamp of expiration date( in second)",
"hash": "solidity hash of the request data",
"payeesIdAddress": "ID addresses of the payees(the position 0 will be the main payee)",
"payeesPaymentAddress": "payment addresses of the payees(the position 0 will be the main payee)(optional)",
"signature": "signature by payee of the hash"

For example:


You can create signed request with the library: