iron-fish / ironfish

A novel cryptocurrency focused on privacy and accessibility.
https://ironfish.network
Mozilla Public License 2.0
964 stars 577 forks source link

EVM description 1/2 #5052

Closed jowparks closed 2 weeks ago

jowparks commented 3 weeks ago

Data Description

Background

To instruct the EVM to CRUD/run smart contract, we need a way of passing arbitrary data in a transaction. Currently our only way of doing this is via 32 byte memos in the notes. If we create a description included in the transaction that contains an arbitrary length data field we can pass data to the EVM.

The data field in a standard ethereum transaction is abi encoded and the first four bytes delineates what function call is being made. We can handle the same data in ironfish for EVM, but we can extend the concept for future data bundles if needed.

Goals

Motivation and Use Cases

The first use case for passing arbitrary data with a transaction will be EVM integration. We need this field in order to pass/initialize transactions in the EVM. Another example application is passage of metadata for bridging providers, or exchange metadata inclusion (outside of the standard memo fields).

Scope

In scope

Out of scope

Design

// hex strings for known data types
enum DataTypes = {
    Undefined: 1;
    EVM: 2;
    ...
}
pub struct Transaction {
    version: TransactionVersion = TransactionVersion.3,
        ...
        // First byte of data is DataType
    **data: Vec<DataDescription>**
}

pub struct DataDescription {
    data_type: u8
    data: Vec<u8>
}

Open questions: