-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
solution: RLP encoding for EIP-4844 transactions
- Loading branch information
Showing
9 changed files
with
266 additions
and
28 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
51 changes: 51 additions & 0 deletions
51
etherjar-tx/src/main/java/io/emeraldpay/etherjar/tx/TransactionWithBlob.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
package io.emeraldpay.etherjar.tx; | ||
|
||
import io.emeraldpay.etherjar.domain.Wei; | ||
import io.emeraldpay.etherjar.hex.Hex32; | ||
import org.bouncycastle.jcajce.provider.digest.Keccak; | ||
|
||
import java.util.List; | ||
|
||
/** | ||
* Transaction with Blobs (EIP-2718) | ||
* | ||
* @see <a href="https://eips.ethereum.org/EIPS/eip-2718">EIP-2718</a> | ||
*/ | ||
public class TransactionWithBlob extends TransactionWithGasPriority { | ||
|
||
private Wei maxFeePerBlobGas; | ||
|
||
/** | ||
* Represents a list of hash outputs from kzg_to_versioned_hash | ||
*/ | ||
private List<Hex32> blobVersionedHashes; | ||
|
||
public Wei getMaxFeePerBlobGas() { | ||
return maxFeePerBlobGas; | ||
} | ||
|
||
public void setMaxFeePerBlobGas(Wei maxFeePerBlobGas) { | ||
this.maxFeePerBlobGas = maxFeePerBlobGas; | ||
} | ||
|
||
public List<Hex32> getBlobVersionedHashes() { | ||
return blobVersionedHashes; | ||
} | ||
|
||
public void setBlobVersionedHashes(List<Hex32> blobVersionedHashes) { | ||
this.blobVersionedHashes = blobVersionedHashes; | ||
} | ||
|
||
@Override | ||
public TransactionType getType() { | ||
return TransactionType.BLOB; | ||
} | ||
|
||
@Override | ||
public byte[] hash() { | ||
byte[] rlp = TransactionEncoder.DEFAULT.encode(this, false); | ||
Keccak.Digest256 keccak = new Keccak.Digest256(); | ||
keccak.update(rlp); | ||
return keccak.digest(); | ||
} | ||
} |
Oops, something went wrong.