ERC-875 · Withdrawn · ERC · 2018-02-08
ERC-875: Simpler NFT standard with batching and native atomic swaps
An early NFT standard that moved tokens in batches by index and let a seller sign an off-chain offer that a buyer settles in one atomic transaction; it was withdrawn.
What problem does it solve?
In early 2018, transferring non-fungible tokens such as event tickets meant one transaction per token. Selling a block of ten seats cost ten transfers' worth of gas, and there was no simple standard way to sell tokens peer to peer without an exchange contract holding orders.
ERC-875 proposed a lighter NFT interface built around two ideas: transfer many tokens in one call, and let a seller sign an offer off chain so the buyer pays and receives the tokens in a single atomic transaction.
How it works
Balances are arrays. balanceOf(owner) returns a uint256[] of the owner's tokens. Transfers take a list of indices into that array, not token IDs:
| Function | Purpose |
|---|---|
name(), symbol() |
Metadata |
balanceOf(owner) → uint256[] |
All tokens held by owner |
transfer(to, uint256[] indices) |
Send several tokens at once |
transferFrom(from, to, uint256[] indices) |
Same, by an authorized party (e.g. contract owner) |
totalSupply(), ownerOf(id) |
Optional |
One Transfer(from, to, uint256[] tokenIndices) event covers the whole batch.
Optional atomic swap. trade(expiry, indices, v, r, s) is payable. The seller signs a message containing the token indices, the price, the expiry time and the contract address. The buyer submits it with the right amount of ether. The contract recovers the signer, checks price and expiry, transfers the tokens and pays the seller. The seller pays no gas, and no order is stored on chain until settlement.
Sample code
The proposed interface (modernized Solidity syntax):
interface IERC875 {
event Transfer(address indexed from, address indexed to, uint256[] tokenIndices);
function name() external view returns (string memory);
function symbol() external view returns (string memory);
function balanceOf(address owner) external view returns (uint256[] memory);
function transfer(address to, uint256[] calldata indices) external;
function transferFrom(address from, address to, uint256[] calldata indices) external;
}
interface IERC875Trade is IERC875 {
function trade(
uint256 expiryTimestamp,
uint256[] calldata tokenIndices,
uint8 v, bytes32 r, bytes32 s
) external payable;
}
Things to know
- This proposal is Withdrawn and was never adopted as a standard. For NFTs use ERC-721; for batch transfers of many token types use ERC-1155.
- Addressing tokens by their index in the owner's balance array is fragile: indices shift as tokens move, so a signed order or pending transaction can end up pointing at a different token than intended.
- The spec says signed trade messages must include the chain ID, contract address and standard name to prevent replay and spoofing, but does not define an exact encoding. Today EIP-712 typed signatures solve that problem.
transferFromhas no approval mechanism in the spec; it is described only as usable by "an authorised party", which leaves security to each implementation.- The example deployments linked in the spec were on the Rinkeby testnet, which has since been shut down.