Position: Home page » Ethereum » How does Ethereum specify nonce

How does Ethereum specify nonce

Publish: 2021-05-27 08:49:11
1. A virtual currency with a wallet doesn't mean it's more professional and advanced. The existence of digital currency wallet is the premise of currency existence. Currency without wallet can be identified as fraud
mainstream digital currencies such as bitcoin, Puyin, Laite, Ethereum and dogcoin all exist in wallets, and wallets existed before the release of such currencies.
2. At the top of Ethereum is DAPP. It exchanges with the smart contract layer through Web3. JS. All smart contracts run on EVM (Ethereum virtual machine) and use RPC calls. Below EVM and RPC are the four core contents of Ethereum, including: blockchain, consensus algorithm, mining and network layer. Except DAPP, all other parts are in the Ethereum client. The most popular Ethereum client is geth (go Ethereum)
3.

Blockchain is a term in the field of information technology. In essence, it is a shared database. The data or information stored in it is characterized by "unforgeability", "trace in the whole process", "traceability", "openness and transparency" and "collective maintenance". Based on these characteristics, blockchain technology has laid a solid "trust" foundation, created a reliable "cooperation" mechanism, and has broad application prospects

on January 10, 2019, the state Internet Information Office issued the regulations on the management of blockchain information services. In October 24, 2019, ring the eighteenth collective learning of the Central Political Bureau, general secretary Xi Jinping stressed that "block chain as an important breakthrough in core technology and independent innovation", "accelerating the development of block chain technology and instrial innovation". "Blockchain" has entered the public field of vision and become the focus of social attention

on December 2, 2019, the word was selected into the top ten catchwords of "biting words" in 2019

extended data:

Application of blockchain Finance:

since 2016, the major financial giants have also carried out blockchain innovation projects to explore the possibility of applying blockchain Technology in various financial scenarios. In particular, Puyin group took the lead in creating a "blockchain +" standard digital currency

standard digital currency refers to the process of assets identification, evaluation, right confirmation and insurance completed by a third party organization, which is written into the blockchain through careful digital algorithm to form the standard corresponding relationship between assets and digital currency, which is called standard digital currency

in order to realize the great leap forward development of blockchain finance, promote the new development of China's economy, accelerate the circulation of global assets, and realize the dream of rejuvenation that has been struggling for generations, Puyin group will hold the Guiyang strategic development ceremony of Puyin blockchain finance in Guizhou on December 9, 2016

the meeting will discuss the realization of digital circulation of assets by blockchain, the financial transaction mode of blockchain, and the application of blockchain services and social public instry. This conference will mark the beginning of the application of blockchain finance and the change and development of the new financial ecology

4. Introction to seven core technologies of blockchain operation on January 15, 2018
1. Blockchain links
as the name suggests, blockchain is a chain composed of blocks. Each block is divided into block head and block body (including transaction data). The block head includes the prevhash value (also known as hash value) of the previous block used to realize the block link and the random number (nonce) used to calculate the mining difficulty. The hash value of the previous block is actually the hash value of the head of the previous block, and the random number calculation rule determines which miner can obtain the right to record the block
2. Consensus mechanism
blockchain is accompanied by the birth of bitcoin, which is the basic technology architecture of bitcoin. Blockchain can be understood as an Internet-based decentralized accounting system. A decentralized digital currency system like bitcoin requires the consistency of accounting of honest nodes without a central node, which needs blockchain to complete. Therefore, the core of blockchain technology is a consensus mechanism to reach a consensus on the legitimacy of transactions between indivials without mutual trust without central control
there are four main types of consensus mechanisms in blockchain: pow, POS, dpos and distributed consistency algorithm
3. Unlocking script
script is an important technology to realize automatic verification and contract execution on blockchain. Every output of every transaction does not point to an address in the strict sense, but to a script. A script is like a set of rules that constrain how the receiver can spend the asset locked on the output
the validation of transactions also depends on scripts. At present, it depends on two kinds of scripts: Lock script and unlock script. Locking script is a condition added to the output transaction, which is realized by a script language and located in the output of the transaction. The unlocking script corresponds to the locking script. Only when the conditions required by the locking script are met can the assets corresponding to the script be spent, which is located in the input of the transaction. Many flexible conditions can be expressed by script language. Interpretation script is similar to the "virtual machine" in our programming field, which runs in every node of the blockchain network in a distributed way
4. Transaction rules
blockchain transaction is not only the basic unit of a block, but also the actual effective content recorded by the blockchain. A blockchain transaction can be a transfer, or the deployment of smart contracts and other transactions
as far as bitcoin is concerned, a transaction refers to a single payment transfer. The transaction rules are as follows:
1) the input and output of the transaction cannot be empty
2) for each input of a transaction, if its corresponding utxo output can be found in the current transaction pool, the transaction will be rejected. Because the current transaction pool is the transaction not recorded in the blockchain, and each input of the transaction should come from the confirmed utxo. If it is found in the current trading pool, it is Shuanghua trading
3) for each input in a transaction, the corresponding output must be utxo
4) each input unlocking script must verify the compliance of the transaction together with the corresponding output locking script
5. Transaction priority
the priority of blockchain transaction is determined by the blockchain protocol rules. For bitcoin, the priority of a transaction to be included in a block is determined by the time when the transaction is broadcast to the network and the amount of the transaction. With the increase of transaction broadcast time on the network and the increase of transaction chain age, the priority of transaction will be improved and eventually be included by the block. For Ethereum, the priority of the transaction is also related to the transaction fee that the publisher is willing to pay. The higher the transaction fee that the publisher is willing to pay, the higher the priority that the transaction is included in the block
6. Merkle proof
the original application of Merkle proof is bitcoin, which was described and created by Satoshi Nakamoto in 2009. Bitcoin blockchain uses Merkle proof to store transactions in each block. So that the transaction can not be tampered with, but also easy to verify whether the transaction is included in a specific block
7. RLP
RLP (recursive length prefix) is one of the main encoding methods of object serialization in Ethereum. Its purpose is to encode the sequence of arbitrary nested binary data.
5. The token of Ethereum is proced in the process of mining, with a mining rate of 5 Ethereum coins per piece. The mining process of Ethereum is almost the same as that of bitcoin. For each transaction, miners can use the computer to run the unique title metadata of the block through hash function, and guess the answer repeatedly and quickly until one of them wins

many new users believe that the sole purpose of mining is to generate ether in a way that does not require a central issuer (see our guide "what is ether?"). It's true. The token of Ethereum is proced in the process of mining, with a mining rate of 5 Ethereum coins per piece. But mining is at least as important. Usually, banks are responsible for keeping accurate records of transactions. They make sure that money is not created out of thin air and that users don't cheat and spend money many times. However, blockchain introces a new way to keep records, the whole network instead of intermediary, to verify transactions and add them to the public ledger

Ethereum mining

although "no trust" or "trust minimization" monetary system is the goal, there are still people who need to ensure the security of financial records and ensure that no one cheats. Mining is one of the innovations that makes decentralized records possible. Miners have reached a consensus on the history of transactions in terms of preventing fraud (especially double spending on ether) - an interesting issue that hasn't been addressed before the decentralized currency works on the blockchain. While Ethereum is looking at other ways to reach a consensus on the effectiveness of the deal, mining currently keeps the platform together

how mining works
today, the mining process of Ethereum is almost the same as that of bitcoin. For each transaction, the miner can use the computer to guess the answer repeatedly and quickly until one of them wins. More specifically, the miner will run the unique header metadata (including time stamp and software version) of the block through the hash function (which will return a fixed length, unordered string of numbers and letters, which appears to be random), changing only the 'nonce value', which will affect the hash value of the result

if the miner finds a hash that matches the current target, the miner will be granted ether and broadcast the block across the network for each node to verify and add to their own ledger . If miner B finds the hash, miner a stops working on the current block and repeats the process for the next block. It's hard for miners to cheat in this game. There is no way to fake the work and come up with the right answer to the puzzle. That's why solving puzzles is called "proof of work."

on the other hand, others have little time to verify whether the hash value is correct, which is exactly what each node does. About every 12-15 seconds, a miner finds a stone. If the miner starts to solve the puzzle faster or slower than this, the algorithm will automatically re adjust the difficulty of the problem so that the miner can rebound to about 12 seconds of solution time

miners earn these ethers randomly, and their profitability depends on their luck and the computing power they put in. The specific workload verification algorithm used by Ethereum is called "ethash", which aims to require more memory, making it difficult to mine with expensive ASIC. Special mining chips are now the only profitable way to mine bitcoin

in a sense, ethash may have achieved this goal successfully, because dedicated ASIC is not available for Ethereum (at least not yet). In addition, as Ethereum aims to shift from proof of work mining to "proof of equity" (which we will discuss below), buying ASIC may not be a wise choice because it may not prove useful for a long time< However, Ethereum may never need miners. Developers plan to abandon proof of work, the algorithm currently used by the network to determine which transactions are valid and protect them from tampering to support proof of equity, which is guaranteed by token owners. If and when the algorithm is launched, proof of equity can become a means to achieve distributed consensus, and the consensus uses less resources.
6. To create a Genesis configuration file:
first, you need to create a "Genesis" JSON configuration file, which describes some parameters of the genesis block. The following is the content of the file:
{
& quot; coinbase": & quot;& quot;,< br />" config": {< br />" homesteadBlock": 5
},
" difficulty": & quot; 0x20000",< br />" extraData": & quot; 0x",< br />" gasLimit": & quot; 0x2FEFD8",< br />" mixhash": & quot;& quot;,< br />" nonce": & quot; 0x0",< br />" parentHash": & quot; 000000000000000000000000",< br />" timestamp": & quot; 0x00",< br />" alloc": {< br />"& quot;:< br />{
" balance":& quot;& quot;
}
}
} 1234567891011213141516171819

the above code into a text file and name it genesis.json

Genesis!:
in order not to conflict with the data of the main chain, it is recommended to establish your own private chain data folder. On my computer, I built an ethdbspace as the Ethereum experimental work area on disk e, and created a privchain folder as the data storage folder of my first private chain
here, in order to facilitate management, I put genesis.json under the ethdbspace folder
open the windows command line

type the following command
geth -- dataDir & quot; E:\ EthDBSpace\ PrivChain" init " E:\ EthDBSpace\ genesis.json" 1

– the dataDir option is used to specify the data directory of our private chain. On my computer, it's E: &; EthDBSpace\ Privchain
init is the genesis command, followed by our Genesis configuration file path
after clicking enter, the execution result is as follows

at this time, genesis is complete
create an account:
in order to do experiments on the private chain, we also need to create our own account on the private chain
windows command line, type
geth -- dataDir & quot; E:\ EthDBSpace\ PrivChain" Console1

we have successfully created the world, so when we enter the client for the second time, we do not need to specify the genesis.json file path again, but directly – dataDir to indicate the private link data path
the console command is used to open the command line of geth
after clicking enter, the client will be initialized for a while. After the command prompt appears, it means that you have entered the geth console

type
personal. Newaccount (& #) in the geth command line; Your Password') 1

the personal.newaccount function is used to create an account, in which the parameter is the account password.
after clicking enter, the account creation address will be listed in green below the command, that is, the public key of the account.
we can check the account balance first, In the geth command line, type:
My = eth. Accounts [0]
eth. Getbalance (my) 12

My = eth. Accounts [0]. The purpose of this sentence is to assign the account address we just created to my variable. This can simplify the subsequent account address input. Among them, eth.accounts records the addresses of all accounts on this machine. Since we created an account for the first time, there is only one account on the computer at present. So here we use eth. Accounts [0] to extract the first account address. The eth.getbalance function is used to obtain the account balance, and the parameters are filled in the account address. The my variable here records the address of the first account

I hope my answer can help you
7. Return the result of ifconfig
eth0 to awk for processing
where - F & # 39;:|< br />+'
this is a separator defined by awk and then matched with "BCAST & quot;, Take the content of the fourth column
since your command is not universal, you can't output the result here, but you should intercept the broadcast address
8.

Transaction

the behavior of blockchain transaction follows different rule sets

< UL >
  • e to the distributed and unlicensed nature of public blockchain, anyone can sign the transaction and broadcast it to the network

  • according to different blockchains, traders will be charged a certain transaction fee, which depends on the needs of users rather than the value of assets in the transaction

  • blockchain transactions do not require any central authority verification. It only needs to use the digital signature algorithm (DSA) corresponding to its blockchain to sign it with the private key

  • once a transaction is signed, broadcast to the network and mined into a successful block in the network, the transaction cannot be recovered

  • Ethereum transaction structure

  • Ethereum transaction data structure: transaction 0.1 eth

    {
    & 39; nonce':&# 39; 0x00', // Decimal: 0
    & 39; gasLimit': &# 39; 0x5208', // Decimal system: 21000
    & 39; gasPrice': &# 39; 0x3b9aca00', // Decimal system: 10000000000
    & 39; to': &# 39;&# 39; ,// Sending address
    & 39; value': &# 39; 0x16345785d8a0000',// 100000000000000000 ,10^17
    ' data': &# 39; 0x', // Decimal representation of null data; chainId': 1 / / blockchain network ID
    }

    these data have nothing to do with the transaction content, but have something to do with the execution mode of the transaction. This is because when you send a transaction in Ethereum, you must define some other parameters to tell miners how to handle your transaction. Transaction data structure has two attribute designs & quot; gas": & quot; gasPrice",& quot; gasLimit"

  • " gasPrice": The unit is Gwei, which is 1 / 1000 eth, indicating the transaction cost

  • & quot; gasLimit": The maximum gas charge allowed for the transaction

  • these two values are usually filled in automatically by the wallet provider

    in addition, you need to specify which Ethereum network to execute the transaction (chainid): 1 represents the Ethereum main network

    ring development, tests are usually carried out locally and on the test network, and transactions are carried out through the test eth issued by the test network to avoid economic losses. After the test, enter the main network transaction

    in addition, if you need to submit some other data, you can use & quot; data" And & quot; nonce" Attach as part of a transaction

    a nonce (number used only once) is the value used by Ethereum to track transactions, which helps to avoid double spending and replay attacks in the network

  • Ethereum transaction signature

    Ethereum transaction involves ECDSA algorithm. Taking JavaScript code as an example, the popular ethers.js is used to call ECDSA algorithm for transaction signature

  • const ethers = require(' ethers')
  • const signer = new ethers.Wallet(' Wallet address

  • signer.signTransaction({

  • ' nonce':&# 39; 0x00', // Decimal: 0

  • & 39; gasLimit': &# 39; 0x5208', // Decimal: 21000

  • & 39; gasPrice': &# 39; 0x3b9aca00', // Decimal 10000000000

  • & 39; to': &# 39;&# 39; ,// Sending address

  • & 39; value': &# 39; 0x16345785d8a0000',// 100000000000000000 ,10^17

  • ' data': &# 39; 0x', // Decimal representation of null data

  • & 39; chainId': 1 / / blockchain network ID

  • })

  • . Then (console. Log)
  • you can use the online application composer to deliver signed transactions to Ethereum. This is known as "offline signature.". Offline signatures are particularly useful for applications such as status channels, which are smart contracts that track the balance between two accounts and transfer funds after a signed transaction is submitted. Offline signature is also a common practice in dexes

    you can also use online wallet to create signature verification and broadcast through Ethereum account

    with Portis, you can sign a transaction to interact with the gas station network (GSN)

    < / UL >

    the Xueshuo innovation blockchain Technology Workstation of Lianqiao ecation online is the only approved "blockchain Technology Specialty" pilot workstation of "smart learning workshop 2020 Xueshuo innovation workstation" launched by the school planning, construction and development center of the Ministry of ecation of China. Based on providing diversified growth paths for students, the professional station promotes the reform of the training mode of the combination of professional degree research, proction, learning and research, and constructs the applied and compound talent training system

    Hot content
    Inn digger Publish: 2021-05-29 20:04:36 Views: 341
    Purchase of virtual currency in trust contract dispute Publish: 2021-05-29 20:04:33 Views: 942
    Blockchain trust machine Publish: 2021-05-29 20:04:26 Views: 720
    Brief introduction of ant mine Publish: 2021-05-29 20:04:25 Views: 848
    Will digital currency open in November Publish: 2021-05-29 19:56:16 Views: 861
    Global digital currency asset exchange Publish: 2021-05-29 19:54:29 Views: 603
    Mining chip machine S11 Publish: 2021-05-29 19:54:26 Views: 945
    Ethereum algorithm Sha3 Publish: 2021-05-29 19:52:40 Views: 643
    Talking about blockchain is not reliable Publish: 2021-05-29 19:52:26 Views: 754
    Mining machine node query Publish: 2021-05-29 19:36:37 Views: 750