Ethereum C language SDK
Hardware
algorithm is difficult to solve in memory. In order to make DAG suitable for memory, each GPU needs 1-2gb of memory. If you get an error prompt: error GPU mining. GPU memory fragmentation? It means you don't have enough memory. GPU mining software is based on OpenCL, amd GPU will be faster than NVIDIA GPU of the same level. ASIC and FPGA are relatively inefficient, so they are blocked. To get OpenCL for chip integration platform, try:
amd SDK OpenCL
NVIDIA CUDA OpenCL
Ubuntu Linux settings
for this quick guide, you will need Ubuntu 14.04 or 15.04 and fglrx image driver. You can also use NVIDIA drives and other platforms, but you have to find your own way to get an effective OpenCL installation, such as genoil's ethminer fork
if you are using 15.04, go to & quot; Software and updates 〉 extra drives & quot; Set to & quot; Use the video driver & quot; from fglrx for AMD graphics accelerator
if you are using 14.04, go to & quot; Software and updates 〉 extra drives & quot; Set to & quot; Use the video driver & quot; from fglrx for AMD graphics accelerator;. Unfortunately, for some people, this method may not work, because there is a known program error in Ubuntu 14.04.02 that will prevent you from switching to the exclusive graphics drive necessary for GPU mining
therefore, if you encounter this program error, go to & quot; "Software and update" update & quot; Select & quot; Pre release reliable update proposal & quot;. Then, back to & quot; Software and updates 〉 extra drives & quot; Set to & quot; Use the video driver & quot; from fglrx for AMD graphics accelerator;. After restarting, it's worth checking that the drive is now properly installed (for example, by going to & quot; Additional drives & quot;)
no matter what you do, if you are using 14.04.02, once installed, do not change the drive or drive configuration. For example, the use of aticonfig – initial (especially the - F, - force option) will & quot; Destruction & quot; Your settings. If you accidentally change the configuration, you will need to uninstall the drive, restart, install the drive again and restart.
a total of 22 weeks, divided into five stages,
the first stage is 4 weeks, go language foundation and network concurrency, learning the introctory go language,
the second stage is 4 weeks, go language practical web development, crawler development, cryptography, consensus algorithm, realizing lightweight public chain, learning the website and crawler that can develop golang, Achieve lightweight blockchain
stage 3, 4-week Ethereum source code analysis and smart contract DAPP development, master Ethereum core and smart contract development, as well as blockchain,
stage 4, 4-week super ledger, bitcoin EOS, source code analysis and smart contract practice, master super ledger development, cat bitcoin, bifurcated EOS after learning, As well as DAPP development of smart contract
phase 5, 6-week project practice, five enterprise level projects, and one year of blockchain project experience after learning
from the characteristics of the language itself, go is a very efficient language, which highly supports concurrency. Go language itself pays more attention to distributed system, and concurrency processing is relatively good, such as advertising and search, That kind of high concurrency server
go language advantages:
excellent performance, can be directly compiled into machine code, does not rely on other libraries, go is extremely fast. Its performance is similar to Java or C + +
concurrency is supported at the language level, which is the biggest feature of go. It is born to support concurrency, and go is the concurrency supported in gene, which can make full use of multi-core and make it easy to use concurrency
the built-in runtime supports garbage collection, which is one of the features of dynamic language. Although GC is not perfect at present, it is enough to cope with most of the situations we can encounter, especially GC after go1.1
it's easy to learn. The authors of go language all have the gene of C, so go naturally has the gene of C. There are 25 go keywords, but the expressive ability is very strong. It almost supports most of the features you've seen in other languages: inheritance, overloading, object, etc
rich standard libraries, go has built a large number of libraries, especially the network library, which is also my favorite part< As like as two peas, br / > built-in powerful tools, Go language is built with many tools chain, the best should be gofmt tools, automatic formatting code, make team review become so simple, code format is exactly the same, it is very difficult to think differently.
cross platform compilation and fast compilation. Compared with the sluggish compilation speed of Java and C + +, the fast compilation time of go is a major efficiency advantage
disadvantages of go language:
package management: package management of go language is absolutely not perfect. By default, it has no way to make a specific version of the dependency library, nor can it create replicable builds. In contrast, python, node and Ruby all have better package management systems. However, with the right tools, the package management of go language can also perform well
lack of development framework: go language does not have a major framework, such as Ruby's rails framework, Python's Django framework or PHP's laravel. This is a heated discussion in the go language community, because many people think that we should not start with using frameworks. This is true in many cases, but if you just want to build a simple crud API, it's much easier to use Django / djrf, rails laravel, or Phoenix
exception handling: go language can help developers deal with compilation errors by simply returning errors (or call stack) through functions and expected calling codes. Although this method is effective, it is easy to lose the scope of the error, so it is difficult to provide meaningful error information to users. Error package can solve this problem by allowing us to add context and stack trace to return error
another problem is that we may forget to handle errors. Static analysis tools such as errcheck and megacheck can avoid these errors. Although these solutions are very effective, they may not be the right way.
Ethereum is an open source public blockchain platform with smart contract function. It provides decentralized virtual machine (Ethereum virtual machine) to process point-to-point contract through its special cryptocurrency ether (also known as "Ethereum")
The token on theblockchain is called ether, and the code is eth. It can be traded in many foreign exchange markets of cryptocurrency, and it is also the medium used to pay transaction fees and computing services on Ethereum
the concept of Ethereum was first proposed by vitalik buterin, a programmer, from 2013 to 2014, inspired by bitcoin, with the general meaning of "next generation cryptocurrency and decentralized application platform", and began to develop through ICO crowdfunding in 2014. As of February 2018, Ethernet is the second highest cryptocurrency in market value, second only to bitcoin
extended data:
Ethereum platform has no characteristics and value. Like programming languages, it's up to entrepreneurs and developers to decide what to use. However, it is clear that some application types benefit more from the functions of Ethereum than others. Ethereum is especially suitable for those applications that automatically interact directly between points or promote group coordination activities across networks
for example, coordinate the application of point-to-point market, or the automation of complex financial contracts. Bitcoin enables indivials to exchange money without the help of financial institutions, banks or governments. The impact of Ethereum may be more profound
in theory, any complex financial activities or transactions can be automatically and reliably carried out on Ethereum with coding. In addition to financial applications, any application scenario with high requirements for trust, security and persistence, such as asset registration, voting, management and Internet of things, will be affected by Ethereum platform on a large scale
java_ The home value is: the directory where JDK is installed, and mine is C: 92; Program Files\ Java\ jdk1.6.0_ 34
the classpath value is:;% JAVA_ HOME%\ lib\ tools.jar;% JAVA_ HOME%\ lib\ dt.jar;% JAVA_ HOME%\ bin;( Pay attention to the & quot& quot; To add)
Path: append at the beginning.;% JAVA_ HOME%\ bin;% JAVA_ HOME%\ jre\ bin;( Pay attention to the & quot& quot; To add)
after the installation, you can check whether the JDK is installed successfully. Open the CMD window and enter Java – version to view the version information of JDK.
system("~/ myprogram/test.sh");} The results are as follows: xiakeyou@ubuntu :~/myprogram$ gcc systemtest.c -o
systemtestxiakeyou@ubuntu :~/myprogram$ ./systemtest/home/d/e/ xiakeyouxiakeyou@ubuntu ~/myprogram$2) Popen (char *command, char *type) execution process: Popen () calls fork () to generate the child process, and then invokes /bin/sh
-c from the sub process to execute the instruction of parameter command. The parameter
type can use "R" for reading and "W" for writing. According to this type value, popen() will establish a pipeline to the standard output device or standard input device of the child process, and then return a file
pointer. Then the process can use this file pointer to read the output device of the child process or write to the standard input device of the child process. In addition, all functions that use the file pointer (file *) operation can also be used
except fclose(). Return value: if successful, the file pointer will be returned; otherwise, null will be returned. The error reason is stored in errno
note: when writing a program with suid / sgid permission, please try to avoid using Popen (), which inherits environment variables and may cause system security problems through environment variables. For example, the content of C program popentest. C is as follows: # include & lt; stdio.h> main(){FILE * fp; charbuffer[80]; fp=popen(“~/myprogram/test.sh”,”r”); fgets(buffer,sizeof(buffer),fp); printf(“%s”,buffer); pclose(fp);} The results are as follows: xiakeyou@ubuntu :~/myprogram$ vim popentest. cxiakeyou@ubuntu :~/myprogram$ gcc popentest.c -o popentestxiakeyou@ubuntu :~/myprogram$ ./popentest/home/d/e/ xiakeyouxiakeyou@ubuntu : ~ / myprogram $
it's just that my ability may be a little limited and I don't understand it very well. It's a script to use system () directly, but the return value is a mess. I tried many times, but I didn't find any rules. I can't help but look at the above blog post and get some inspiration, which can be realized as follows: first, use echo & gt; to return the script value; Xxxxx output to a local file, when you need this return value is, but through the C language file operation function to read directly from the file, later on, this should be the Popen implementation method! There are three ways for C program to call shell script: system (), Poppen (), exec series function system ()
you don't need to generate a process by yourself, it has been encapsulated, you need to fork your own process to directly add your own command exec, and then the exec's own command Poppen () can also execute your command, which is less than the system cost. 1) system (shell command or shell script path); System() will call fork() to generate a subprocess, and the subprocess will call / bin / SH-C string to perform the command represented by the
parameter string string. After the command is performed, the original calling process will be returned immediately. The sigchld
signal will be temporarily suspended while the SIGINT and sigquit signals will be ignored ring the call to system()
return value: if system() fails to call / bin / sh, 127 will be returned, and - 1 will be returned for other failure reasons. If the parameter string is null, a non-zero value is returned
if the system() call is successful, the return value after the
shell command is fulfilled will be returned. However, this return value may also be the 127 returned when the system() call / bin / sh fails. Therefore, it is better to reflect on errno
to confirm the successful fulfillment. System command is widely used because of its simple and efficient function. Here is an example: there is a shell script test.sh in ~ / test / directory, and the content is #! Bin / bash#test.shecho Hello create a new C file system in the same layer directory_ Test. C, the content is: # include & lt; stdlib.h> int main(){system("~/ test/test.sh");} The effect of performance is as follows:[ root@localhost test]$gcc system_ test.c -o system_ test[ root@localhost test]$./system_ testhello[ root@localhost Test]$2) Popen (char *command, char *type) Popen () calls fork () to generate the child process, and then invokes /bin/sh -c from the sub process to perform the instruction of
parameter /bin/sh. The parameter type can be applied with "R" for read and "W" for write. Following this type value, popen() creates a
pipeline to the standard output device or standard input device of the child process, and then returns a file pointer. Then the process can use this file pointer to read the output device of the sub process
or write it to the standard input device of the sub process. In addition,
can be applied to all functions that apply file pointer (file *), except fclose(). Return value: if successful, the file pointer will be returned; otherwise, null will be returned; the error
reason is stored in errno. Note: when you write a program with suid / sgid permission, please try to avoid using Popen (), which will inherit environment variables, which may cause system security problems. For example, the content of C program popentest. C is as follows: # include & lt; stdio.h> main{FILE * fp; charbuffer[80]; fp=popen(“~/myprogram/test.sh”,”r”); fgets(buffer,sizeof(buffer),fp); printf(“%s”,buffer); pclose(fp);} The effect of performance is as follows:[ root@localhost test]$ vim popentest.c[ root@localhost test]$ gcc popentest.c -o popentest[ root@localhost test]$ ./popentest/root/test[ root@localhost test]$
#include<stdio.h>
struct
{
charstr[10];
}a[3];
intmain()
{
FILE*fp=fopen("log","r");
inti,t;
if(fp==NULL)return1;
for(i=0;i<3;i++)
{
fscanf(fp,"id.%dstring:%s ",&t,a[i].str);//读到结构体存储
printf("id.%dstring:%s ",i+1,a[i].str);//输出
}
fclose(fp);
return0;
}
