stellz' blog


ATProto Payment Identities

Right now, you can't really do payments in a verifiable way on top of ATProto alone, because we lack the global consensus that pretty much every decentralized value transmission system depends on to be secure. There's plenty of use cases people might like to build on top of socially verifiable value transmission - basically any sort of commerce, such as "pay what you want" models for digital content like blog posts or music. To do so, we need to be able to link a payment method to an ATProto identity.

Gas is pretty damn cheap now on major blockchains - i regularly send ETH or USDC around for pennies of network gas fee. This makes it pretty viable as a plain payment rail. Could we use this existing machinery to allow verifiable payments on ATProto ? Yes 🙂. Today we'll cover my basic idea for this.

Multiple Identities in Web3

We've got two identity methods in the mix here. 1st, an ATProto DID such a mine, did:plc:7mnpet2pvof2llhpcwattscf. 2nd, a wallet address associated to a private key - mine is 0x91443aF8B0B551Ba45208f03D32B22029969576c, which is what my ENS domain stellz.eth points to.

Note: for purposes of this argument, we're just going to talk about blockchains based around the Ethereum virtual machine (EVM). If you like another kind of blockchain (Monero & ZCash are pretty cool), please imagine that in place of the EVM. It works with whatever private key, really.

To make an ATProto identity able to make payments on a blockchain, we must establish a 2-way verifiable link between the DID and the wallet address. How?

Wallet Message Signing

In the blockchain-based corner of what we call "web3", the user's wallet is the root of identity. Originally, this was just for controlling funds associated to your private key, but nowadays it's common to use wallet-signed messages as a method of login authentication, or identity+intent verification. These signed messages do not interact with the actual blockchain at all (usually), and are merely to prove that a given identity has a given intent.

This signing capability works with arbitrary messages. We can use that fact to establish the verifiable link we need.

Step by Step

1st

The EVM wallet controller signs a message with content like this: did:plc:7mnpet2pvof2llhpcwattscf controls 0x91443aF8B0B551Ba45208f03D32B22029969576c.

2nd

The signed message is stored in a record in the user's ATProto repo. The lexicon for that looks something like this:

{
    "lexicon": 1,
    "id": "club.stellz.evm.addressControlAttestation",
    "defs": {
        "main": {
            "type": "record",
            "description": "An attestation that this DID controls an EVM wallet address",
            "record": {
                "type": "object",
                "required": [
                    "address",
                    "attestation"
                ],
                "properties": {
                    "address": {
                        "type": "bytes",
                        "minLength": 20,
                        "maxLength": 20,
                        "description": "An Ethereum VM address."
                    },
                    "attestation": {
                        "type": "bytes",
                        "description": "a message '<did> controls <address>', which must include & be signed by the address in question to be valid"
                    }
                }
            }
        }
    }
}

By storing this signed message inside the user's PDS, we now get the required 2-way verification: the wallet-signed message confirms that "this wallet blesses this DID", and storing it in the repo confirms the other direction, "this DID blesses this wallet".

3rd

When somebody wants to actually use this attestation to make a payment to a DID-based identity, it can be verified by checking that the bytes included in attestation match up exactly with the bytes produced by the given address signing that message.

Making it a good UX

Suggesting message signing for wallets is a standard crypto frontend capability.

OAuth based on your DID is a standard capability of ATProto frontends.

By combining these two, it should be possible to create a friendly frontend for producing this sort of cross-verifiable attestation, as well as for suggesting EVM transactions based off of atproto records. Imagine a "Pay this DID" button which merely suggests to your existing wallet a transaction like "send 0.01 ETH to 0x91443aF8B0B551Ba45208f03D32B22029969576c"

A Call to Enjoyoooors

If you have experience building in the blockchain-based corner of web3 and want to pursue building this sort of stuff on atproto, I think it's a very fruitful intersection, and i'm looking for more fellow travellers. Please reach out to me, @piss.beauty, on Bluesky or in person at a blockchain industry event, and talk to me about your ideas. There's so much to build.