Ethereum Web3 call contract
If you want to query the transaction records on the main network, you can use Etherscan. However, if you build your own private chain, how should you query the transaction records
the answer is that you need to listen to the logs on the chain, save them in the database, and then query them in the database. For example:
< pre t = "code" L = "Java" > varaddr = & quot& quot;< br />varfilter=web3.eth.filter({fromB lock:0 ,toBlock:' latest', address:addr });< br />filter.get(function(err,transactions){transactions.forEach(function(tx){
vartxInfo=web3.eth.getTransaction(tx.transactionHash);
/ / at this time, the transaction information txinfo can be stored in the database
})< br />}); Pre >
Web3. Eth. Filter() is used to monitor the log on the chain, and Web3. Eth. Gettransaction() is used to extract the information of the specified transaction. Once the transaction information is obtained, it can be stored in the database for query
recommend a practical introction, you can see: Ethereum tutorial
what is Ethereum
Ethereum is often compared with bitcoin, but the situation is different. Bitcoin is a kind of cryptocurrency and distributed payment network, which allows bitcoin to be transferred between users
related: what is bitcoin? How does it work
Ethereum has a bigger goal. As Ethereum says, "Ethereum is a distributed platform running smart contracts.". These smart contracts run on "Ethereum virtual machine", a distributed computing network composed of all devices running Ethernet nodes
"distributed platform" means that anyone can set up and run an Ethereum node just as anyone can run a bitcoin node. Anyone who wants to run "smart contracts" on nodes must pay the operators of these nodes in ether, which is a cryptocurrency related to Ethereum. Therefore, the person running the Ethernet node provides computing power and gets paid in the Ethernet, which is similar to the way that the person running the bitcoin node provides hash power and pays in bitcoin
in other words, although bitcoin is only a blockchain and payment network, Ethereum is a distributed computing network, and its blockchain can be used for many other things. Details are provided in the Ethereum white paper
what is ether
Ethernet is a digital token (or cryptocurrency) related to Ethereum blockchain. In other words, Ethereum is the token and Ethereum is the platform. But now people often use these terms alternately. For example, coinbase allows you to buy Ethereum, which stands for Ethereum
this is technically "altcoin", which actually means a non bitcoin cryptocurrency. Like bitcoin, ether is supported by distributed blockchain - in this case, Ethereum blockchain
developers who want to create applications or Ethereum smart contracts on Ethereum blockchain need Ethernet token to pay for nodes to host it, while users of Ethereum based applications may need Ethernet to pay for services in these applications. People can also sell services outside the Ethereum network and accept Ethernet payments, or they can sell Ethernet tokens in cash - just like bitcoin
Yes, refer to the interaction between contracts. Digital currency exchange platform for example, I am trying to sign a smart contract from another factory contract and then redeploy the address of the new smart contract. However, the address it returns is the transaction hash, not the contract address. I believe this is because when the address is returned, the contract has not been exploited. When I deploy the smart contract with Web3, it seems that it will not output the contract address until the smart contract is deployed
Generally speaking, the steps of deploying smart contract are as follows:
- start an Ethereum node (such as geth or testrpc) Li >
- use Solc to compile smart contracts=& gt; Get the binary code Li >
- deploy the compiled contract to the network This step will consume Ethernet currency, and you need to use the default address or specified address of your node to sign the contract.)=& gt; Get the blockchain address and ABI of the contract (JSON representation of the contract interface, including variables, events and callable methods) The author confused ABI with contract interface here. ABI is the binary representation of the contract interface.) Li >
- use the JavaScript API provided by web3.js to call the contract Depending on the type of call, it may consume Ethernet currency.) li>
Ruitai coin has not been launched on the third-party platform, but it is rumored that it will also be launched on the third-party platform.
Percy Jackson is an ordinary 12-year-old boy who was diagnosed with dyslexia and hyperactivity disorder. During a field trip organized by the school, he was interviewed by his algebra teacher; Specific function & quot; Scared me. After that, Percy Jackson found that he was not an ordinary person, but a mythical figure and a descendant of human beings< After discovering the mystery of his life, Percy Jackson was sent to a special school. The children studying in this school are the offspring of many mythical characters. When Percy Jackson came to school, Poseidon immediately declared Jackson his own child. In this school, Percy Jackson met two good friends. One is the beautiful Annabeth chase, the descendant of Athena, the goddess of wisdom and skill; The other is Grover Underwood, a descendant of orcs. Not long in the school, Percy Jackson was accused by the gods of stealing the thunder rod of Zeus. Percy Jackson is required to hand over his thunder wand within 10 days, otherwise, his mother will be killed by these gods, and the war between the gods is inevitable...
there is still one minute left: three discriminated high school students have invented a time machine that allows them to go back in time and change their social status, And help other unfairly treated children to avoid the humiliation of discrimination in high school
twilight 2, new moon and 1 are about vampires. Bella (Kristen Stewart) is 18 years old and her father gives her a gift. Edward (Robert Pattinson) shows her love generously and tells her the legend of the Italian vampire king. Edward's red haired sister Alice (Ashley Greene, Ashley Greene) holds a birthday party specially for Bella. During the party, Bella accidentally cuts her arm and is attacked by Gaspar. Only with Edward's protection can she escape. However, since then, Edward graally alienated Bella and proposed to break up. This makes Bella cold, but Edward also has difficulties, still secretly protect Bella. Bella is in the empty window period, and her old friend Jacob (Taylor Lautner) makes a warm call, which makes their relationship warm up. Since then, Bella because of the cliff rescue, just know that Jacob is a werewolf, specialized in dealing with vampires. At the same time, Edward, who didn't know about it, thought Bella had committed suicide and was disheartened. He came to Italy to ask the royal family to end his life...
bloodthirsty daybreak, I think the ending is a little ironic
2012 is also very good, and the fantasy show of Arthur and his mini kingdom is also very good
the working principle of nativscript: calling native API with JavaScript to realize cross platform
nativscript is a cross platform solution recently launched, which allows you to directly write Android and IOS local applications with JavaScript, It will be extended to Windows platform in the future. It's a project that has received more attention recently. It is essentially different from NW (formerly known as node WebKit, using web to write winodw / Linux desktop application) and phonegap embedded WebView to write app. It calls the system native API directly with JavaScript, so it has some native application characteristics.
1 start an Ethereum node (such as geth or testrpc)
2 use Solc to compile smart contracts=& gt; Get the binary code
3 deploy the compiled contract to the network This step will consume Ethernet currency, and you need to use the default address or specified address of your node to sign the contract.)=& gt; Get the blockchain address and ABI of the contract (JSON representation of the contract interface, including variables, events and callable methods) The author confused ABI with contract interface here. ABI is the binary representation of the contract interface.)
4 use the JavaScript API provided by web3.js to call the contract Depending on the type of call, it may consume Ethernet currency.)