Ethereum: Ponimania Identifikators transaction and creation of an affiliate
As a stroke, stringing for blocks, in the ethereum network, you, verifiable, familiar with the importance of the unique identifier for each transaction. In this state, we will be able to think about the identification of the transaction (TX ID) in ethereum and take it to the subtlety.
What is the editing transaction?
In the ethereum, the transaction is served by a unique identification for each transaction, which is set off on the network. He is used by a virtual ethereum (EVM) for identification and transaction on the blockchain. ID TX is usually generated by when the transaction is provided with the functioning of transaction
in solidy or ethers.js.
How to generate an identification transaction
To spread the transaction of transaction, you need to enter the serialized version of the data, which includes in the sebed:
- Data about transaction : This can be included in the sort of such fields, as the shada of the gas, the Limit gas, the nonsets and the hundredth.
- Klavyshi Shifting
: You need to paste these fields, use a pair of Klavish (closed key and open key).
Here’s the Primer in Solidnost:
`
Pragma Polidy ^0.8,0;
Import “
MYContract {
Transaction function () public proventy (uint256) {
// Create a new object of transaction
Transactiondata txdata = transactiondata (
Bytes4 (abi.encodepacked (“Standard”, “Gasprice”, “Gaslimit”))))
);
// Shifting the field with the closed key
byte memory encryptedtxdata = incrypt (txdata);
// Read the ID TX B Vidue Double Hasha Sha-256 Celated Transaction
UINT256 TXID = KECCAK256 (Encryptedtxdata, 0x6e8738A2A35FCD5B1C9F24D8F3E4DD7BFBE94B1CAAFEC9CEFF2C44BD51A14);
Return TXID;
}
}
Struct transactiondata {
STOPY OFFICATION; // the amount that will be cut off
Uint256 Gasprice; // Vi Vay (Suddening on the shadow of the gas)
uint256 gaslimit; // maximally adverse quantity of gas units that can be dusted in a single block
}
Function Encrypt (transactiondata txdata) intra -pure views (byte memory) {
byte memory encryptedtxdata = abi.encodepacked (
txdata.value,
txdata.gasprice,
txdata.gaslimit
);
Return Keccak256 (Encryptedtxdata, 0x6e8738A2A35FCD5B1C9F3E4DDD7BFBE94B1CAAFEC9CEFF2C44BD51A14);
}
`
In this one, we make the structure of transactiondata
for the chronicles of transaction and function” sifting “, which improves this structure and grows up its closed version.
TX ID
The TX ID is cleared with the use of the hash -functions Keccak256
with the coded transaction in the cure of the second argument. The first 128 bit of the half hasha introduces the Hash SHA-256 of the gifted transaction, which is a time-over 64 bit of time and a new one (that’s the clutch block).
To spread the TX ID for your own transaction, you can use this formula:
TXID = KECCAK256 (Encryptedtxdata, Timestamp + NONCE)
Here’s the Primer:
`
Pragma Polidy ^0.8,0;
MYContract {
Transaction function () public proventy (uint256) {
// Create a new object of transaction
Transactiondata txdata = transactiondata (
Abi