我相信这个答案可以在以下文件中找到:
https://github.com/bitpay/java-bitpay-client/blob/master/src/main/java/controller/BitPay.java – 也就是说,您将在BitPay客户端实例上设置私钥.在那里,您可以根据需要找到适当的构造函数.您将根据具体需要使用以下一个或多个字段:
private ECKey _ecKey = null;
private String _identity = "";
private String _clientName = "";
private Hashtable _tokenCache;
例如,如果您使用以下构造函数:
public BitPay(URI privateKey) throws BitPayException,URISyntaxException,IOException {
this(KeyUtils.loadEcKey(privateKey),BITPAY_PLUGIN_INFO,BITPAY_URL);
}
您将传入您的私钥的URI.
两个很简单的例子:
BitPay bitpay = new BitPay();
ECKey key = KeyUtils.createEcKey();
this.bitpay = new BitPay(key);
第二:
// Create the private key external to the SDK,store it in a file,and inject the private key into the SDK.
String privateKey = KeyUtils.getKeyStringFromFile(privateKeyFile);
ECKey key = KeyUtils.createEcKeyFromHexString(privateKey);
this.bitpay = new BitPay(key);
实现私钥后,您将需要初始化客户端并连接到服务器.