Friday, June 27, 2025
Social icon element need JNews Essential plugin to be activated.
No Result
View All Result
Crypto now 24
  • HOME
  • BITCOIN
  • CRYPTO UPDATES
    • GENERAL
    • ALTCOINS
    • ETHEREUM
    • CRYPTO EXCHANGES
    • CRYPTO MINING
  • BLOCKCHAIN
  • NFT
  • DEFI
  • METAVERSE
  • WEB3
  • REGULATIONS
  • SCAMS
  • ANALYSIS
  • VIDEOS
MARKETCAP
  • HOME
  • BITCOIN
  • CRYPTO UPDATES
    • GENERAL
    • ALTCOINS
    • ETHEREUM
    • CRYPTO EXCHANGES
    • CRYPTO MINING
  • BLOCKCHAIN
  • NFT
  • DEFI
  • METAVERSE
  • WEB3
  • REGULATIONS
  • SCAMS
  • ANALYSIS
  • VIDEOS
No Result
View All Result
Crypto now 24
No Result
View All Result

EIP-4844 Blob Transactions Support in Web3j

March 18, 2024
in Web3
Reading Time: 12 mins read
A A
0

[ad_1]

In an thrilling growth for the Ethereum and blockchain developer neighborhood, Web3j has grow to be the primary web3 library to implement help for sending EIP-4844 blob transactions to Ethereum shoppers. This replace brings us one step nearer to the way forward for Ethereum scalability and effectivity, providing a glimpse into what full knowledge sharding may finally appear to be for the community.

Understanding EIP-4844 and its impression

EIP-4844, recognized for introducing “blob-carrying transactions” to Ethereum, is designed to accommodate giant quantities of knowledge that can not be accessed by EVM execution, however whose dedication might be accessed. This revolutionary strategy permits for vital knowledge to be briefly saved on the beacon node, enhancing the community’s capability to deal with giant info.

Full knowledge sharding will nonetheless take a substantial period of time to complete implementing and deploying. This EIP gives a stop-gap answer till that time by implementing the transaction format that might be utilized in sharding, however not truly sharding these transactions. As an alternative, the information from this transaction format is just a part of the beacon chain and is absolutely downloaded by all consensus nodes (however might be deleted after solely a comparatively brief delay). In comparison with full knowledge sharding, this EIP has a diminished cap on the variety of these transactions that may be included, akin to a goal of ~0.375 MB per block and a restrict of ~0.75 MB. 

Presently L2 networks or Rollups spend quite a bit to guarantee that their transaction knowledge is out there to all of their nodes and validators. Most rollups do that by writing their knowledge to Ethereum as calldata. That prices about $1000 per megabyte at present costs. Good rollups minimize that to $300 per megabyte through the use of superior knowledge compression. Nonetheless, knowledge posting value makes up the most important portion of L2 transaction charges. With EIP4844 blob knowledge, Ethereum meets the information availability wants of rollups, so they supply a brand new, and hopefully cheaper, manner for rollups to report their knowledge, which might assist in considerably decreasing the transaction charges on Layer 2 networks like Optimism, Polygon zkEVM, Arbitrum, Starknet, and so forth.

New Transaction Sort Spec in EIP-4844

EIP-4844 transactions comply with the brand new kind of EIP-2718 transaction, “blob transaction”, the place the TransactionType is BLOB_TX_TYPE = Bytes1(0x03). The fields chain_id, nonce, max_priority_fee_per_gas, max_fee_per_gas, gas_limit, worth, knowledge, and access_list comply with the identical semantics as EIP-1559.

There are two extra added fields max_fee_per_blob_gas is a uint256 and the sphere blob_versioned_hashes represents a listing of hash outputs from kzg_to_versioned_hash.

Networking

We will ship a signed EIP-4844 transaction utilizing web3j to eth_sendRawTransaction API and the uncooked kind have to be the community kind. This implies it consists of the tx_payload_body, blobs, KZG commitments, and KZG proofs.

Every of those components are outlined as follows:

tx_payload_body – is the TransactionPayloadBody of ordinary EIP-2718 blob transaction
blobs – listing of Blob objects
commitments – listing of KZGCommitment of the corresponding blobs
proofs – listing of KZGProof of the corresponding blobs and commitments

Code Instance: Sending a Blob Transaction with Web3j

Earlier than continuing with the next code instance, please make sure that the community you might be working with has EIP-4844 help enabled.

To make the most of the EIP-4844 blob transaction characteristic in Web3j, builders can comply with this instance:

 

public class Web3jEIP4844Example {

    public static void primary(String[] args) throws Exception {

        // Initialize Web3j and Credentials

        Web3j web3j = Web3j.construct(new HttpService(“<nodeUrl>”));

        Credentials credentials = Credentials.create(“<privateKey>”);

        // Get the present nonce for the account

        BigInteger nonce = web3j.ethGetTransactionCount(

                credentials.getAddress(), DefaultBlockParameterName.LATEST)

                .ship()

                .getTransactionCount();

    // Get the Present Base Price Per Blob Fuel worth

    BigInteger blobBaseFee = web3j.ethGetBaseFeePerBlobGas();

    System.out.println(“blobBaseFee = “ + blobBaseFee);

// Multiply baseFeePerBlobGasValue with applicable quantity to set it as our maxFeePerBlobGas worth

BigInteger maxFeePerBlobGas =  BigInteger.valueOf((lengthy) (web3j.ethGetBaseFeePerBlobGas().longValue() * 1.1));

        // Create a blob transaction

        RawTransaction rawTransaction = createEip4844Transaction(

                nonce, maxFeePerBlobGas);

        // Signal the transaction

        byte[] signedMessage = TransactionEncoder.signMessage(rawTransaction, credentials);

        String hexValue = Numeric.toHexString(signedMessage);

        // Ship the transaction

        EthSendTransaction ethSendTransaction = web3j.ethSendRawTransaction(hexValue).ship();

        System.out.println(“Transaction hash: “ + ethSendTransaction.getTransactionHash());

System.out.println(“Tx Receipt = “ + web3j.ethGetTransactionReceipt(ethSendTransaction.getTransactionHash()).ship().getTransactionReceipt());

    }

personal static RawTransaction createEip4844RawTransaction(BigInteger nonce, BigInteger maxFeePerBlobGas) {

        Listing<Blob> blobs = new ArrayList<>();

        blobs.add(new Blob(“<blobData_in_Bytes>”));

        return RawTransaction.createTransaction(

                blobs,

                11155111L,

                nonce,

                BigInteger.valueOf(10_000_000_000L),

                BigInteger.valueOf(50_000_000_000L),

                BigInteger.valueOf(3_00_000L),

                “<toAddress>”,

                BigInteger.valueOf(0),

                “”,

                maxFeePerBlobGas);

    }

}

If we simply wish to calculate KZG dedication and KZG proofs from a blob, we are able to try this utilizing BlobUtils Class features.

Blob blob = new Blob(

        Numeric.hexStringToByteArray(

                loadResourceAsString(“blob_data.txt”)));

Bytes dedication = BlobUtils.getCommitment(blob);

Bytes proofs = BlobUtils.getProof(blob, dedication);

Bytes versionedHashes = BlobUtils.kzgToVersionedHash(dedication);

BlobUtils.checkProofValidity(blob, dedication, proofs)

For Builders who’re involved in testing the PRs associated to EIP-4844 in web3j –

Implementing Blob Trasnactions – https://github.com/web3j/web3j/pull/2000
Implementing New Block Header format, getting Base Blob Price, and new Transaction Receipt format – https://github.com/web3j/web3j/pull/2006

These PRs are included in web3j launch model >=4.11.0

Conclusion

The latest integration of EIP-4844 blob transactions by Web3j as the primary web3 library to embrace this innovation showcases its dedication to blockchain growth and newest developments.

This weblog submit has delved into the technical intricacies of EIP-4844, from its potential impression on Ethereum’s scalability to the specificities of the brand new transaction kind it introduces. 

Moreover, sensible insights into utilising Web3j for sending EIP-4844 transactions present builders with the instruments essential to discover this new frontier.

[ad_2]

Source link

Tags: BlobEIP4844SupportTransactionsWeb3j
Previous Post

HTC VIVE Speaks on Apple Vision Pro, AI at MWC 2024

Next Post

Bitcoin Price goes past $ 64,000 for the very First time in last 2 years.

Next Post
Bitcoin Price goes past $ 64,000  for the very First time in last 2 years.

Bitcoin Price goes past $ 64,000 for the very First time in last 2 years.

Blast – Explore New Projects

Blast – Explore New Projects

Does BingX Require KYC? All BingX KYC Limits Revealed

Does BingX Require KYC? All BingX KYC Limits Revealed

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

Social icon element need JNews Essential plugin to be activated.

CATEGORIES

  • Altcoin
  • Analysis
  • Bitcoin
  • Blockchain
  • Crypto Exchanges
  • Crypto Mining
  • Crypto Updates
  • DeFi
  • Ethereum
  • Metaverse
  • NFT
  • Regulations
  • Scam Alert
  • Uncategorized
  • Videos
  • Web3

SITE MAP

  • Disclaimer
  • Privacy Policy
  • DMCA
  • Cookie Privacy Policy
  • Terms and Conditions
  • Contact us

Copyright © 2023 Crypto Now 24.
Crypto Now 24 is not responsible for the content of external sites.

No Result
View All Result
  • HOME
  • BITCOIN
  • CRYPTO UPDATES
    • GENERAL
    • ALTCOINS
    • ETHEREUM
    • CRYPTO EXCHANGES
    • CRYPTO MINING
  • BLOCKCHAIN
  • NFT
  • DEFI
  • METAVERSE
  • WEB3
  • REGULATIONS
  • SCAMS
  • ANALYSIS
  • VIDEOS

Copyright © 2023 Crypto Now 24.
Crypto Now 24 is not responsible for the content of external sites.