🔬
Ethscriptions
Ethscriptions Docs
Ethscriptions Docs
  • 👋Overview
    • Introducing Ethscriptions
    • Quick Start
    • Protocol Specification
  • 💡ESIPs
    • What are ESIPs?
    • Accepted ESIPs
      • ESIP-1: Smart Contract Ethscription Transfers
      • ESIP-2: Safe Trustless Smart Contract Ethscription Escrow
      • ESIP-3: Smart Contract Ethscription Creations
      • ESIP-5: Bulk Ethscription Transfers from EOAs
      • ESIP-6: Opt-in Ethscription Non-uniqueness
      • ESIP-7: Support Gzipped Calldata in Ethscription Creation
      • ESIP-8: Ethscription Attachments aka "BlobScriptions"
    • Draft ESIPs
      • ESIP-XX: Extending Ethscriptions to L2 Networks
      • DEPRECATED: ESIP-4: The Ethscriptions Virtual Machine
  • ⚙️API Docs
    • API Overview
  • 😍Community Projects
    • Floored Ape Ethscribe
    • Ethscriber.xyz
Powered by GitBook
On this page
  • Abstract
  • Specification
  • Rationale
  1. ESIPs
  2. Accepted ESIPs

ESIP-3: Smart Contract Ethscription Creations

PreviousESIP-2: Safe Trustless Smart Contract Ethscription EscrowNextESIP-5: Bulk Ethscription Transfers from EOAs

Last updated 1 year ago

Abstract

ESIP-3 introduces a mechanism for smart contracts to create ethscriptions using Ethereum events. Start block: 18130000

Specification

Add a new smart contract event into the Ethscriptions Protocol:

event ethscriptions_protocol_CreateEthscription(
    address indexed initialOwner,
    string contentURI
);

When a contract emits this event in or after block 18130000, the protocol should register a valid ethscription creation attempt with:

  1. contentURI interpreted as the ethscription's utf-8 encoded dataURI with all null bytes removed.

  2. initialOwner as the created ethscription's initial owner.

  3. The emitting contract as the creator.

Functionally speaking, this event is the equivalent of an EOA hex-encoding contentURI and putting it in the calldata of an Ethereum transaction from itself to initialOwner. As with ethscriptions created via input data, all null bytes are removed from the UTF8 contentURI of ethscriptions created through events.

As with EOA-initiated ethscription creations, ESIP-3 ethscription creations are only valid if contentURI is both unique and .

Example contentURI format

data:,1234.

Note: it is utf-8 encoded, not hex-encoded. Note also this specific example is a duplicate and would not result in an ethscription creation.

Ethscriptions and Ethereum Transactions remain 1-1

ESIP-3 does not change the fact that each Ethereum transaction may have only one corresponding ethscription. If multiple aspects of a transaction constitute valid ethscription creations, calldata will be prioritized over events, and events with lower log indices will be prioritized over those with higher indices.

Example 1:

  1. Calldata: valid creation

  2. Event Log Index 1: valid creation

  3. Event Log Index 2: valid creation

In this case, an ethscription will be created according to the calldata and Events 1 and 2 will be ignored.

Example 2:

  1. Calldata: empty (i.e., invalid creation)

  2. Event Log Index 1: valid creation

  3. Event Log Index 2: valid creation

Here, Event 1's log will trigger the ethscription creation. If calldata and Event 1 were both invalid then Event 2's log would trigger the ethscription creation.

Rationale

Contracts must have the same powers as EOAs and this is the cheapest way to do it.

We propose maintaining the 1-1 correspondence between ethscriptions and Ethereum transactions because the convention that ethscriptionId = transactionHash has proven useful.

For example, instead of forcing a user to bulk create ethscriptions of this form:

data:,{"p":"erc-20","op":"mint","tick":"fair","id":"17560","amt":"1000"}
data:,{"p":"erc-20","op":"mint","tick":"fair","id":"17561","amt":"1000"}
data:,{"p":"erc-20","op":"mint","tick":"fair","id":"17562","amt":"1000"}
data:,{"p":"erc-20","op":"mint","tick":"fair","id":"17563","amt":"1000"}
data:,{"p":"erc-20","op":"mint","tick":"fair","id":"17564","amt":"1000"}
data:,{"p":"erc-20","op":"mint","tick":"fair","id":"17565","amt":"1000"}
data:,{"p":"erc-20","op":"mint","tick":"fair","id":"17566","amt":"1000"}
...

We should capture the user's intent with a single ethscription containing the command mint(50).

File size

Unlike calldata, events have no size limit (aside from the 30M block gas limit). Practically this means that ESIP-3 expands ethscriptions' file size limit to beyond 3.5MB.

Multiple ethscriptions in a transaction are also an inefficient way of capturing a user's intent. Creating multiple ethscriptions in a transaction will always have an underlying purpose and structure, and we should be capturing this structure using .

💡
a syntactically valid dataURI
ESIP-4