Skip to content

RFC: ESIP-11 - Transferring (and bulk) of ethscriptions, through Blobs #20

@tunnckoCore

Description

@tunnckoCore

Since we are going with CBOR for ESIP-8 #17, it makes transferring (bulk and not) even cheaper because the ethscription size will be static data:;rule=esip6, and blob space is cheap. This also allows for transferring to multiple different addresses in one go, which can be useful for AIRDROPS to a bunch of people.

It could be something like, CBOR containing transfers which is an array of to, transaction_hash objects.

{
  transfers: [
    { to_address: '0xd9F6...992f', transaction_hash: '0x0cbddcfda...53b7c99dc6'  },
    { to_address: '0x3e7a...e5b5', transaction_hash: '0x1234'  }
    { to_address: '0xF64b...46e8', transaction_hash: '0x567'  }
  ]
}

The from is clear, it's the creator of the blob transaction.

Currently the ESIP-8/CBOR creation should take this into account and only do its stuff when cbor.content is detected.

Here's my handling

const inputData = `0x${fromTxBlobs(blobs)}` as `0x${string}`;

const inputBytes = tryUngzip(hexToBytes(inputData));

// that's not ESIP-8-spec compliant, but i'm handling/support non-cbor-ed blobs too.
const data = inputData.startsWith('0xb90002') ? decodeCborX(inputBytes) : { content: hexToBytes(inputData) };

if (data.content) {
  data.content = tryUngzip(data.content);
  data.size = data.content.length;

  // raw json handling
  let rawJson;
  try {
    const str = bytesToString(data.content);

    rawJson = JSON.parse(str.startsWith('data:') ? str.slice(str.indexOf(',') + 1) : str);
    data.mimetype = 'application/json';
    data.content_json = rawJson;
  } catch {}

  if (!rawJson && data.mimetype && data.mimetype.includes('application/') && data.mimetype.includes('json')) {
    try {
      data.content_json = JSON.parse(bytesToString(data.content));
    } catch {}
  }
}

data.sha = sha256(inputBytes);
data.transaction_hash = txHash;

return data;

And because it's used just as "signaling layer" of changing state that already exists in the system (eg. db/history of ethscriptions ownership changes), these blobs can be skipped of persistrance - eg. not saving them in db like other blobs, cuz it's not really neaded. What will happen is that you'll add these transfers to valid_transfers of the given ethscription in transaction_hash of the transfer object.

cc @RogerPodacter

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions