简体   繁体   English

为区块链钱包生成新地址

[英]generate new address for blockchain wallet

I am using blockchain API to generate a new address for every wallet. 我正在使用区块链API为每个钱包生成一个新地址。
Here is the code: 这是代码:

<?php
$guid = "7c74bb77-4e25-4eea-a9d3-df1cf6a9d218";
$main_password = "******";
$label = "firsttym";
$json_url = "http://localhost:3000/merchant/$guid/new_address?
password = $main_password & label = $label";

$json_data = file_get_contents($json_url);

$json_feed = json_decode($json_data ,true);

$message = $json_feed->message;
$txid = $json_feed->tx_hash;
?>

It always returns this warning: 它总是返回以下警告:

Warning: file_get_contents(localhost:3000/merchant/7c74bb77-4e25-4eea‌​-a9d3-df1cf6a9d218/…‌​) [function.file-get-contents]: failed to open stream: 警告:file_get_contents(localhost:3000 / merchant / 7c74bb77-4e25-4eea‌-a9d3-df1cf6a9d218 /…‌)[function.file-get-contents]:无法打开流:
A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond. 连接尝试失败是因为连接的一方在一段时间后未正确响应,或者建立的连接失败是因为连接的主机未能响应。

in C:\\wamp\\www\\block\\first.php on line 8 在第8行的C:\\ wamp \\ www \\ block \\ first.php中

Fatal error: Maximum execution time of 30 seconds exceeded in C:\\wamp\\www\\block\\first.php on line 8 致命错误:第8行的C:\\ wamp \\ www \\ block \\ first.php中超过30秒的最大执行时间

You might want to try it like this: I have been using this to get new addresses 您可能想要这样尝试:我一直在使用它来获取新地址

Don't forget to start the block chain service before you make the request 发出请求之前,别忘了启动区块链服务

blockchain-wallet-service start --port 3000 区块链钱包服务启动-端口3000

$url = "http://localhost:3000/merchant/$guid/new_address?password=$password&label=$label";
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: application/json'));
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);



   $data = json_decode(curl_exec($ch), TRUE);

   return $data;

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM