Position: Home page » Ethereum » Ethereum client web3j

Ethereum client web3j

Publish: 2021-05-15 23:58:34
1. Ethereum also uses blockchain technology, but it is more convenient to use than bitcoin's blockchain Turing, which is complete and open source. Anyone can create their own application on the basis of Ethereum
2.

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 />});

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

3.

Blockchain projects require high efficiency, so most of the core source code development is using C / C + +. However, if you are doing a blockchain project, unless you need to make a lot of adjustments to the source code, you may not choose to use Java. For general DAPP applications, java development should also be a good choice. For example, in the case of Ethereum blockchain, there is a web3j class library for Java, which is very convenient; Bitcoin has bitcoin J class library, which is also easy to use. It still depends on the level of application, what to do, and the situation of the team

share two Java blockchain tutorials:

  1. java bitcoin details

  2. java Ethereum development

  3. < / OL >
4. The Internet has just begun, intelligent life coming
5. 客户端代码是这样的
#import "ViewController.h"
@implementation ViewController
-(void)aaa:(UIButton *)btn
{
NSString *method=[NSString stringWithFormat:@"login"];
NSString *username=[NSString stringWithFormat:@"123"];
笭肠蒂段郦灯垫犬叮华 NSString *password=[NSString stringWithFormat:@"123"];
NSString *urlString= [NSString stringWithFormat:@"",@"method=",method,@"username=",username,@"password=",password];

ASIFormDataRequest *requestForm = [[ASIFormDataRequest alloc] initWithURL:[NSURL URLWithString:urlString]];
//设置需要POST的数据,这里提交两个数据,A=a&B=b
//[requestForm setPostValue:@"a" forKey:@"A"];
//[requestForm setPostValue:@"b" forKey:@"B"];
[requestForm startSynchronous];

//输入返回的信息
NSLog(@"response\n%@",[requestForm responseString]);
[requestForm release];
}
- (void)viewDidLoad
{
[super viewDidLoad];
button1=[[UIButton alloc]initWithFrame:CGRectMake(200, 200, 50, 50)];
button1.backgroundColor=[UIColor redColor];
[self.view addSubview:button1];
[button1 addTarget:self action:@selector(aaa:) forControlEvents:UIControlEventTouchUpInside];
// Do any additional setup after loading the view, typically from a nib.
}
- (void)viewDidUnload
{
[super viewDidUnload];
// Release any retained subviews of the main view.
}
- (BOOL):(UIInterfaceOrientation)interfaceOrientation
{
return (interfaceOrientation != );
}
@end
客户端想要访问服务器
必须加上服务器的ip 服务端我是这样实现的
服务器是用java开发的
public
void doLogin(HttpServletRequest request,HttpServletResponse response) throws
IOException{
String
username=request.getParameter("username");
String
password=request.getParameter("password");
String
getStr=request.getParameter("A");
System.out.println("用户名:"+username+
"密码:"+password);
getAddr(request);
PrintWriter
out=response.getWriter();
String msg=null;
if(username!=null&&username.equals("123")&&password!=null
&&password.equals("123")&&
getStr!=null&&getStr.equals("a")){
msg="登陆成功";
}
else
{
msg="登陆失败";
}

out.print(msg);
out.flush();
out.close();
}
6. The native API of JS and the API leaked by the browser can be tens of thousands of difficulties, let alone hundreds of thousands. If you are talking about calling the API of the desktop operating system, you can use nodejs. If you are talking about calling the API of the smartphone operating system, you can make the object encapsulation system API leaked by the WebView control, Or package your app with something like phonegap, you can call the API provided by it, and check the corresponding documents for the specific usage.

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.
7. Install git on the Internet, download and install it, and then try again.
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