让我们假设我们有一个进行某些交易的网络,在某个特定的稍后点,监管者会作为观察者节点加入。有没有办法将之前的交易(已经发生的交易)发送给监管机构?
答案 0 :(得分:2)
您还可以使用SendStateAndRefFlow,这将减少将来支持SGX分类帐加密所涉及的迁移工作量。
答案 1 :(得分:1)
是的,package com.example.finalui;
import android.app.Fragment;
import android.content.Context;
import android.net.Uri;
import android.util.Log;
import com.android.volley.DefaultRetryPolicy;
import com.android.volley.Request;
import com.android.volley.RequestQueue;
import com.android.volley.Response;
import com.android.volley.RetryPolicy;
import com.android.volley.VolleyError;
import com.android.volley.toolbox.StringRequest;
import com.android.volley.toolbox.Volley;
import java.util.Map;
//import vv.sci2home.user.doorhopper.AppEssentials.ApplicationVariable;
/**
* Created by Vaibhav on 9/19/2016.
*/
public class VvVolleyClass {
private Context activityContext;
//private Context applicationContext;
private VvVolleyInterface resultInterface;
Map<String, String> params;
RequestQueue queue;
public VvVolleyClass(Context c1, Context c2){
activityContext = c1;
//applicationContext = c2;
this.resultInterface = (VvVolleyInterface) c1;
}
public VvVolleyClass(Context activityContext){
this.activityContext = activityContext;
//applicationContext = c2;
this.resultInterface = (VvVolleyInterface) activityContext;
}
public VvVolleyClass(Fragment f, Context c1, Context c2){
activityContext = c1;
//applicationContext = c2;
this.resultInterface = (VvVolleyInterface) f;
}
public void makeRequest(String url, Map<String, String> parameters) {
params = parameters;
if(ApplicationVariable.ACCOUNT_DATA.token != null){
params.put("token", ApplicationVariable.ACCOUNT_DATA.token);
}
queue = Volley.newRequestQueue(activityContext);
Log.d("DHU", "SERVER FETCH:" + url);
Log.d("DHU", "SERVER FETCH:" + parameters.toString());
StringRequest stringRequest = new StringRequest(Request.Method.POST, url,
new Response.Listener<String>() {
@Override
public void onResponse(String response) {
Log.d("DHU", "SERVER FETCH:" + response);
// Display the first 500 characters of the response string.
resultInterface.onTaskComplete(response);
}
},
new Response.ErrorListener() {
@Override
public void onErrorResponse(VolleyError error) {
Log.d("DHU", "SERVER FETCH:" + error.toString());
if(error.networkResponse != null)
Log.d("DHU", "SERVER FETCH:" + error.networkResponse.data);
resultInterface.onTaskComplete("Unexpected Error!" + error.toString());
error.printStackTrace();
}
}) {
@Override
protected Map<String, String> getParams() {
return params;
}
};
stringRequest.setTag("request");
int socketTimeout = 20000;//30 seconds - change to what you want
RetryPolicy policy = new DefaultRetryPolicy(socketTimeout, -1,
DefaultRetryPolicy.DEFAULT_BACKOFF_MULT);
stringRequest.setRetryPolicy(policy);
queue.add(stringRequest);
}
public void makeRequestGet(String url, Map<String, String> parameters) {
params = parameters;
Log.d("DHU", "SERVER FETCH:" + url);
Log.d("DHU", "SERVER FETCH:" + parameters.toString());
// Instantiate the RequestQueue.
queue = Volley.newRequestQueue(activityContext);
// Request a string response from the provided URL.
String values = "";
Uri.Builder uri = Uri.parse(url).buildUpon();
for ( String key : parameters.keySet() ) {
uri.appendQueryParameter(key, parameters.get(key));
}
values = uri.build().toString();
StringRequest stringRequest = new StringRequest(Request.Method.GET, values,
new Response.Listener<String>() {
@Override
public void onResponse(String response) {
Log.d("DHU", "SERVER FETCH:" + response);
// Display the first 500 characters of the response string.
resultInterface.onTaskComplete(response);
}
},
new Response.ErrorListener() {
@Override
public void onErrorResponse(VolleyError error) {
Log.d("DHU", "SERVER FETCH:" + error.toString());
Log.d("DHU", "SERVER FETCH:" + error.networkResponse.data);
resultInterface.onTaskComplete("Unexpected Error!" + error.toString());
error.printStackTrace();
}
}) {
};
stringRequest.setTag("request");
// Add the request to the RequestQueue.
int socketTimeout = 20000;//30 seconds - change to what you want
RetryPolicy policy = new DefaultRetryPolicy(socketTimeout, -1,
DefaultRetryPolicy.DEFAULT_BACKOFF_MULT);
stringRequest.setRetryPolicy(policy);
queue.add(stringRequest);
}
public void cancelAllRequest(){
if(queue != null)
queue.cancelAll("request");
}
}
是Corda平台的一部分。
您提供交易哈希值和将交易发送到的一方(作为SendTransactionFlow的参数)。
唯一的技巧是,由于监管机构将不会成为各州的参与者,因此您需要确保使用ALL_VISIBLE作为记录级别。
有关更多信息,请查看这些docs