Ethereum Web3 document
just like bitcoin, Ethereum is neither controlled nor owned by anyone - it is an open source project created by many people around the world. Different from bitcoin protocol, Ethereum's design is very flexible and adaptable. It is very easy to create new applications on the Ethereum platform. With the release of homestead, anyone can use the applications on this platform safely
Ethereum is a programmable blockchain. It does not give users a series of preset operations, but allows users to create complex operations according to their own wishes. In this way, it can be used as a platform for many types of decentralized blockchain applications
in a narrow sense, Ethereum refers to a series of protocols that define a decentralized application platform. The core of Ethereum is Ethereum virtual machine (EVM), which can encode any complex algorithm. In computer science terminology, Ethereum is "Turing complete.". Developers can use the existing JavaScript and python as the model of other friendly programming languages to create applications running on the Ethereum simulator.
what is Ethereum:
Ethereum is an innovation based on the application of technologies and concepts in bitcoin to computers. Ethereum itself imitates a lot of bitcoin technology to maintain the computer platform. Blockchain technology is one of them
Ethereum platform can safely run any program users want
advantages of Ethereum over other competitive currencies before Ethereum appeared, some digital currencies imitated bitcoin. However, these projects have their own shortcomings, they can only support one or several specific applications at the same time< However, the reason why Ethereum can surpass the limitations of these projects in the past is because of the core idea of Ethereum
what Ethereum wants to implement is a blockchain protocol with built-in programming language. Since it supports programming language, in theory, any blockchain application can be defined with this language, and then run on Ethereum's blockchain protocol as an application
The design of Ethereum is very flexible and adaptable
Ethereum target sets the advantages of blockchain technology, in order to add the advantages of blockchain, such as decentralization, openness and security, to almost all computing fields
blockchain applications of Ethereum
Ethereum has many blockchain applications, such as digital applications of gold and stocks, financial derivatives applications, DNS and digital authentication, etc
Ethereum has achieved more than 100 blockchain applications by many start-ups
Ethereum has also been closely watched by some financial institutions, banking consortia (such as R3), as well as large companies like Samsung, Deloitte, RWE and IBM. As a result, a number of blockchain applications such as simplified and automated financial transactions, merchant loyalty index tracking, and gift cards designed to achieve decentralization of electronic transactions have emerged
the relationship between Ethereum and blockchain:
Ethereum is a programmable blockchain
Ethereum does not give users a series of preset operations (such as bitcoin transaction), but allows users to create complex operations according to their own wishes
in this way, Ethereum can be used as a platform for various types of decentralized blockchain applications, including but not limited to cryptocurrency
like other blockchains, Ethereum also has a peer-to-peer network protocol. Ethereum blockchain database is maintained and updated by many nodes connected to the network. Each network node runs the Ethereum simulator and executes the same instructions. Therefore, people sometimes call Ethereum "world computer"
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
when installing Linux, if you have a network card, the installation program will prompt you to give the configuration parameters of TCP / IP network, such as the IP address of the local computer, the IP address of the default gateway, the IP address of DNS, etc, The installation program will automatically compile the network card (Linux system must first support) driver into the kernel. But we must understand the process of loading the network card driver, so we can easily operate when changing the network card and using multiple network cards in the future. The network card driver is loaded into the kernel as a mole, All the network card drivers supported by Linux are stored in the directory / lib / moles / (Linux version number) / net /, for example, the driver of Inter's 82559 series 10 / 100M self-adaptive boot network card is eepro100. O, 3Com's 3c509 isa network card is 3c509. O, dlink's PCI 10 network card is via Rhine. O, NE2000 compatible network card drivers are ne2k PCI. O and ne. O. after understanding these basic drivers, we can change the network card or add the network card by modifying the mole configuration file.
1. Modify the / etc / conf.moles file
this configuration file is an important parameter file to load the mole, Let's first look at a sample file
# / etc / conf.moles
alias eth0 eepro100
alias eth1 eepro100
this file is the content of conf.moles in a Linux system with two inter 82559 series network cards. The alias command indicates the name of the driver that the Ethernet port (such as eth0) has, If you use the command modprobe eth0, the system will automatically load eepro100. O into the kernel, Therefore, it is not necessary to use options in conf.moles to specify the IO address and interrupt number of the network card. However, corresponding to isa network card, you must specify the IO address or interrupt number of the hardware in conf.moles, as shown below, It shows a conf.moles file of NE isa NIC.
alias eth0 ne
Options ne IO = 0x300 IRQ = 5
after modifying the conf.moles file, you can use the command to load the mole, For example, to insert the second network card of inter:
? Insmod / lib / moles / 2.2.14/net/eepro100. O
in this way, the mole eepro100. O can be loaded at the Ethernet port, You can also use the command to view the currently loaded mole information:
[ root@ice /Etc] # lsmod
mole size used by
eepro100 15652 (autoclean)
the meaning of the returned result is that the currently loaded mole is eepro100, with 15652 bytes in size and two users, The method is to clear automatically.
2. Modify the / etc / lilo.conf file
in some relatively new Linux versions, because the operating system automatically detects all related hardware, there is no need to modify the / etc / lilo.conf file at this time, You can modify the lilo.conf file. Add the following command to the / etc / lilo.conf file:
append = & quot; ether=5,0x240,eth0 ether=7,0x300,eth1" <
the meaning of this command is that the IO address of eth0 is 0x240, the interrupt is 5, the IO address of eth1 is 0x300, and the interrupt is 7.
in fact, this statement comes from the parameter passed when the system boot image file,
Lilo: Linux ether = 5,0x240, eth0 ether = 7,0x300, eth1
this method can also make the Linux system configure two network cards, When using more than three network cards, you can follow the same method.
after configuring the network card, you should configure the TCP / IP parameters. In general, when installing the Linux system, you will be prompted to configure the network parameters, You can use the following commands:
? Ifconfig eth0 a.b.c.d netmask e.f.g.h
a.b.c.d is the IP address of eth0, and e.f.g.h is the netmask.
in fact, in Linux system, we can set multiple IP addresses for a network card, such as the following command:
? Ifconfig eth0: 1 202.112.11.218 netmask 255.255.192
then, Use the command "ifconfig - a" to see the interfaces of all network interfaces:
eth0 link encap:Ethernet HWaddr 00:90:27:58:AF:1A
inet addr:202.112.13.204 Bcast :202.112.13.255 M ask:255.255.255.192
UP BROADCAST RUNNING MULTICAST MTU:1500 M etric:1
RX packets:435510 errors :0 dropped:0 overruns :0 frame:2
TX packets:538988 e rrors:0 dropped :0 overruns:0 carrier :0
c ollisions:318683 txqueuelen :100
I nterrupt:10 Base address:0xc000
eth0:1 Link encap:Ethernet HWaddr 00:90:27:58:AF:1A
inet addr:202.112.11.218 Bcast :202.112.11.255 M ask:255.255.255.192
UP BROADCAST RUNNING MULTICAST MTU:1500 M etric:1
I nterrupt:10 Base address:0xc000 < br />
lo Link encap:Local Loopback
inet addr:127.0.0.1 Mask :255.0.0.0
UP LOOPBACK RUNNING MTU:3924 M etric:1
RX packets:2055 errors :0 dropped:0 overruns :0 frame:0
TX packets:2055 errors :0 dropped:0 overruns :0 carrier:0
c ollisions:0 txqueuelen : 0
we can see that there are three network interfaces, eth0, eth0:1, lo, Eth0 is the real Ethernet interface. Eth0:1 and eth0 are the same network card, but they are bound with another address. Lo is the sending address. Eth0 and eth0:1 can use IP addresses of different network segments, which is very useful when the same physical network segment uses different network addresses<
in addition, the network card has a mode of prosimc. In this mode, the network card will receive all the packets in the network. Some network monitoring tools under Linux, such as tcpmp and snort, all set the network card to hybrid mode.
the ifconfig command can change the IP address of the network card ring the running time, but if the system is restarted, the IP address of the network card will be changed, Linux still starts the network interface according to the original default settings. At this time, you can use netconfig or NETCONF command to reset the default network parameters. Netconfig command is to reconfigure the basic TCP / IP parameters, including whether to dynamically obtain IP address (dhcpd and BOOTP), IP address of network card, network mask, default gateway and preferred domain name server address. NETCONF command can configure all network parameters in detail, which is divided into three parts: client task, server task and other configuration. In the client configuration, it mainly includes the configuration of basic host (host name, valid domain name, network alias, IP address of corresponding network card, network mask, network device name, kernel driver of network device), DNS address configuration, default gateway address configuration, NIS address configuration, IPX interface configuration, PPP / slip configuration and so on. In the server configuration, it mainly includes the configuration of NFS, DNS, Apache webserver, samba and Wu ftpd. Among the other configuration options, one is about the host configuration in the / etc / hosts file, one is about the network configuration information in the / etc / networks file, and the last is about the configuration information using linuxconf
under the command of linuxconf, you can also configure the network information, but you can find that the linuxconf program calls NETCONF to configure the network
in addition, the system configuration files about the network are stored in the / etc / sysconfig / network scripts directory. Examples are as follows:
: & lt; br>& lt; br>
ifcfg-eth0 * ifdown post * ifup aliases * ifup PPP *
ifcfg-eth1 * ifdown PPP * ifup IPX * ifup routes *
ifcfg lo * ifdown sl * ifup PLIP * ifup sl *
ifdown @ ifup @ ifup post * network functions
ifcfg-eth0 is the configuration information of Ethernet port eth0, and its contents are as follows:
device = & quot; eth0" /* Specify the network device name * /
IPADDR = & quot; 202.112.13.204" /* Indicate the IP address of the network device * /
netmask = & quot; 255.255.255.192" /* Specify network mask * /
Network = 202.112.13.192 / * specify network address * /
broadcast = 202.112.13.255 / * specify broadcast address * /
onboot = & quot; yes" /* Indicates whether the network card is activated at system startup * /
bootproto = & quot; none" /* Indicates whether to use BOOTP protocol * /
therefore, we can also modify this file to change the network parameters under Linux[/ Size]
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -, It introces the files related to the configuration of Linux network services.
1. The configuration file of Lilo
in Linux system, there is a system boot program, Lilo (Linux loadin), which can be used to realize the selective startup of multiple operating systems. Its configuration file is / etc / lilo.conf.in this configuration file, the configuration parameters of Lilo are mainly divided into two parts, One is the global configuration parameters, including setting the boot device and so on. The other is the local configuration parameters, including the configuration parameters of each boot image file. I will not describe each parameter in detail here, but only two important parameters: password and restricted option. The password option adds password protection to each boot image file.
as we all know, In Linux system, there is a single user mode. In this mode, the user logs in to the Linux system as a super user. By adding parameters (Linux single or Linux init 0) ring Lilo boot, people can directly enter the single user mode super user environment without password, This will be very dangerous. So the password configuration option is added in lilo.conf to add password protection to each image file.
you can use the password option in global mode (add the same password to all image files), or add a password to each indivial image file, You may find it troublesome to enter the password every time. You can use the restricted option, which enables Lilo to check the password only when the parameters (such as Linux single) are entered ring Linux startup. These two options can greatly increase the security of the system, It is recommended to set them in lilo.conf file.
since password is stored in plaintext in / etc / lilo.conf file, it is necessary to change the attribute of / etc / lilo.conf file to only root readable (0400).
in addition, in the early version of Lilo, there was a limitation that the boot sector must be stored in the first 1024 cylinder, which was broken in Lilo version 2.51, After downloading and decompressing the latest version, use the command make & quot; Note: physical security is the most basic security, even if the password protection is added in lilo.conf, if there is no password protection in lilo.conf
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.
