Wallet Transaction Signing API (Functional) | Algorand Developer Portal
Wallet Transaction Signing API (Functional)
This ARC is intended to be completely compatible with ARC-1.
Abstract
ARC-1 defines a standard for signing transactions with security in mind. This proposal is a strict subset of ARC-1 that outlines only the minimum functionality required in order to be usable.
Wallets that conform to ARC-1 already conform to this API.
Wallets conforming to ARC-5 but not ARC-1 MUST only be used for testing purposes and MUST NOT be used on MainNet. This is because this ARC-5 does not provide the same security guarantees as ARC-1 to protect properly wallet users.
Specification
The key words “ MUST”, “ MUST NOT”, “ REQUIRED”, “ SHALL”, “ SHALL NOT”, “ SHOULD”, “ SHOULD NOT”, “ RECOMMENDED”, “ MAY”, and “ OPTIONAL” in this document are to be interpreted as described in RFC-2119.
Comments like this are non-normative.
Interface SignTxnsFunction
Signatures are requested by calling a function signTxns(txns) on a list txns of transactions. The dApp may also provide an optional parameter opts.
A wallet transaction signing function signTxns is defined by the following interface:
export type SignTxnsFunction = (
txns: WalletTransaction[],
opts?: SignTxnsOpts,
)
=> Promise<(SignedTxnStr | null)[]>;
A SignTxnsFunction:
- expects
txnsto be in the correct format as specified byWalletTransaction.
Interface WalletTransaction
export interface WalletTransaction {
/**
* Base64 encoding of the canonical msgpack encoding of a Transaction.
*/
txn: string;
}
Semantic requirements
- The call
signTxns(txns, opts)MUST either throw an error or return an arrayretof the same length as thetxnsarray. - Each element of
retMUST be a validSignedTxnStrwith the underlying transaction exactly matchingtxns[i].txn.
This ARC uses interchangeably the terms “throw an error” and “reject a promise with an error”.
signTxns SHOULD follow the error standard specified in ARC-0001.
UI requirements
Wallets satisfying this ARC but not ARC-0001 MUST clearly display a warning to the user that they MUST not be used with real funds on MainNet.
Rationale
This simplified version of ARC-0001 exists for two main reasons:
- To outline the minimum amount of functionality needed in order to be useful.
- To serve as a stepping stone towards full ARC-0001 compatibility.
While this ARC MUST not be used by users with real funds on MainNet for security reasons, this simplified API sets a lower bar and acts as a signpost for which wallets can even be used at all.
Security Considerations
None.
Copyright
Copyright and related rights waived via CCO.