A platform for creating, sharing, and minting AI art
AIrtist is like Instagram for AI art: instead of uploading photos, users enter text prompts used by AI to generate the images. Features include both "web 2.0" style social features like commenting, liking, and reposting, as well as (optional) web3 features like minting images as NFTs on the blockchain.
AIrtist uses "account abstraction" to make it seamless for users, without needing wallets nor gas tokens to get started. Even when minting NFTs, users never have to "send transactions", "sign messages", nor write down 12- or 24-word phrases on pieces of paper.
AIrtist uses sponsor tech related to the following tracks for the Safe “March for Account Abstraction” Hackathon:
Using web3Auth, AIrtist login options include social, email, or wallet. Social/email logins will generate an app-specific private key … behind the scenes, no seed phrase needed – only the user has access to the complete private key (self-custody), enabled by Multi-Party Computation (MPC).
Social login users:
Note that when choosing the wallet
login option, AIrtist checks for an ENS name for the connecting address, and if found, will use that as the "name" of the user on AIrtist. For example, if I choose to login via web3auth using my primary Metamask address, AIrtist will show me as markcarey.eth
.
Several "web 2.0" styles features include:
repost
does not re-share the same identical image, but rather uses the same identical text prompt to generate an entirely new image.Some users may optionally decide to mint images as NFTs on the blockchain. When users post new artwork, they can:
Creators can always decide later -- after posting -- to mint their own images.
Minting during art creation is done by toggling a checkbox. For images already posted, minting involves a single click/tap. In both cases, the user does not have to send transactions nor sign messages.
When minting your own artwork, it costs 1 pAInt
token. When minting images posted by others, you pay the price set by the creator, denominated in either pAInt
or WETH
.
pAInt
is a native Super Token that supports real-time streaming, powered by Superfluid. It acts as a utility token on the AIrtist platform for minting NFTs. Users start with 5 pAInt
and after their first mint, active users receive 3 pAInt
per month, streamed in real-time.
See the streams on Superfluid Console. It's like watching paint stream.😐
When the user decides to mint their first NFT -- and not before -- on-chain transactions are triggered, behind the scenes:
3 pAInt
per month to the Safe.Remember, the above 4 transactions happen behind the scenes. From the user's perspective all they did was check a box or tap a link.
AIrtist uses Gelato Relay to send tokens and NFTs to users' Safes (and one more action discussed below). These requests are signed and submitted on-chain by Gelato relayers, with gas paid from AIrtist's Gelato 1 Balance account. Each of the three contracts deployed by AIrtist support ERC2771 Context which enables secure transactions to be signed by AIrtist but relayed onchain by Gelato Relayers. This works seamlessly with OpenZeppelin's AccessControl
permissions to restrict functions to authorized signers.
Subsequent NFT minting triggers a single transaction -- via Gelato Relay -- to mint the NFT to their Safe, while withdrawing 1 pAInt
from the Safe for each NFT minted of their own art (or the required amount of pAInt
or WETH
if minting others’ art). If a user has less than 1 pAInt
they cannot mint and must wait until they accumulate enough via the incoming stream (or by other means 🦄)
Scenario: a creator has joined AIrtist and posted several images, but has not minted any yet. But the creator has enabled minting of the posts, and set prices and currencies (pAInt
or WETH
) in each case. What happens when another user decides to mint these images? How does the creator get paid, when no Safe has (yet) be deployed for the creator? As mentioned above, the Safe is only deployed when the user does their first mint, and not before. Even though the Safe has not been deployed, the creator still gets paid! When the creator joined AIrtist, the Safe SDK is used to accurately predict the user's Safe address, even though it has not yet been deployed. This predicted Safe address is assigned to creator's user account, and when pAInt
or WETH
gets sent to that address, it just works, and the funds are owned by the predicted Safe address. When/if the creator triggers their first mint, the Safe will then be deployed to the predicted address and the creator will have full access to the tokens sent previously.
Since we are sponsoring -- paying the gas for -- users' transactions, using pAInt
as a utility token helps limit the gas costs associated with users on the FREE plan. These users receive 3 pAInt
monthly, streamed in real-time.
For serious AIrtists, minting 3 NFTs per month may not be enough.
AIrtist uses a freemium business model, where cloud-computing and gas costs are subsidized (sponsored) for FREE users, while revenue from PRO users more than offsets those costs.
AIrtist PRO is a monthly subscription powered by Stripe Billing. Consistent with the goal of account abstraction, PRO users pay via credit card recurring billing (with future plans to add support for crypto-native billing options).
30 pAInt
streamed monthly in real-timeWhen a user buys a PRO subscription, an event is sent from Stripe to a webhook endpoint on the AIrtist API. This triggers the 2 transactions (via Gelato Relay) to deploy an NFT contract for the user and to increase the stream to 30 pAInt
per month. Additionally, as an "upgrade bonus", 10 pAInt
are airdropped to the PRO user's Safe at the time of the upgrade. From this point forward, the user's images are minted to their own contract/collection, which contains only their own artwork.
When a PRO subscription is cancelled, another event webhook automatically triggers a transaction to reduce the stream back to 3 pAInt
per month and flip the user back to minting on the shared NFT contract.
There are three main categories of code for AIrtist:
The live demo of the front end AIrtist app is located at https://airtist.xyz. The app includes javascript code that primarily interfaces with AIrtist server API endpoints.
The javascript web3auth SDK is used in the frontend to power all forms of authentication. Using web3 auth, the user can choose to login with social apps (ie. Twitter/Facebook), email, or wallet (ie. Metamask/WalletConnect). The web3auth SDK interfaces with the nodes in the Auth Network to produce an app-specific private key for the user. The private key exists only in the browser and it never sent to AIrtist servers nor saved by any third party. The web3auth SDK also produced a JWT auth token, that is used by AIrtist as an API key when calling authenticated AIrtist API endpoints (see more below).
The frontend uses the Firebase Firestore SDK to fetch and render AIrtist data stored in a Firestore data store: data about users, posts, followers, social reactions, etc.
The HTML and CSS of the AIrtist frontend was built using the Instello Ultimate Photo Sharing HTML Template set, used under license.
The frontend is hosted using Firebase Hosting. The frontend code can be found in the repo at server/hosting/.
AIrtist uses three core services from Google Firebase for server-side functions.
tokenId
of a newly minted NFT, or the nftContract
address of a newly deployed AIrtNFT
contract for a PRO user.Three smart contracts were written in Solidity for AIrtist:
AIrtNFT.sol
- This is an ERC721
NFT smart contract, leveraging OpenZeppelin contracts. A notable inclusion is the support for ERC2771Context
which enables secure permission-based function calls via Gelato Relay. Also added are two minting functions which power minting of new images, collecting and transferring pAInt
or WETH
tokens when necessary.AIrtNFTFactory.sol
- This a factory contract used to deploy minimal Clones of the AIrtNFT.sol
contract. This contract was used to deployed the main NFT contract that is shared by FREE users, and also used to deploy NFT contracts for each PRO user when they upgrade. Fun fact: Using the minimal clone approach, it actually costs less gas to deploy an NFT contract for a PRO user, compared to minting an AIrtist NFT!.Streamer.sol
- This contract uses the Superfluid protocol to enable streaming of the pAInt
utility token, which was also deployed by this contract at deployment time. The core function of the streamer contract enables the starting, updating or stopping of a pAInt
stream to a recipient, while optionally dropping some pAInt
immediately (not streamed).AIrtNFT
contract: 0x85ea20193d88A4e4BCb45224CE462029608158c3
#AIrtNFTFactory
contract: 0x9d1248BA4EF720da649aE5bFa9cA46311C028af4
#Streamer
contract: 0x83D4A49b80Af1CE060361A457a02d057560A9aD9
#pAInt
Super Token: 0xB66cf6eAf3A2f7c348e91bf1504d37a834aBEB8A
#AirNFT
contract deployed using the factory contract via Gelato Relay: 0xbeccc3e7bfcc3a2071ff4c11ef5eab7d134906f2
#Note: the "Transactions" tab on Etherscan shows empty (or almost) for the above contracts. This is because almost all transactions are executed via Gelato Relay. As such, you can view the "Internal Transactions" tab to view the activity on these contracts.
Here are some quick links to code in this repo, including some examples of where hackathon sponsor tech was used: