| 
50 | 50 | 
 
  | 
51 | 51 | ```  | 
52 | 52 | dependencies {  | 
53 |  | -    compile 'com.bigchaindb.bigchaindb-driver:1.0'  | 
 | 53 | +    implementation 'com.bigchaindb.bigchaindb-driver:1.2'  | 
54 | 54 |     }  | 
55 | 55 |       | 
56 | 56 | ```  | 
 | 
66 | 66 | ### Set up your configuration  | 
67 | 67 | - If you don't have app-id and app-key, you can register one at [https://testnet.bigchaindb.com/](https://testnet.bigchaindb.com/)  | 
68 | 68 | 
 
  | 
 | 69 | +#### single node setup  | 
69 | 70 | ```java  | 
70 | 71 | BigchainDbConfigBuilder  | 
71 | 72 | 	.baseUrl("https://test.bigchaindb.com/")  | 
72 | 73 | 	.addToken("app_id", <your-app-id>)  | 
73 | 74 | 	.addToken("app_key", <your-app-key>).setup();  | 
74 | 75 | ```  | 
 | 76 | +#### multi-node setup (more robust and reliable)  | 
 | 77 | +> **Note** - multi-node setup is only available in version 1.2 and later  | 
 | 78 | +> **Assumption** -This setup assumes that defined multiple nodes are all connected within same BigchainDB network  | 
75 | 79 | 
  | 
 | 80 | +```java  | 
 | 81 | +	//define connections  | 
 | 82 | +    Map<String, Object> conn1Config = new HashMap<String, Object>(),   | 
 | 83 | +                 conn2Config = new HashMap<String, Object>();  | 
 | 84 | +      | 
 | 85 | +    //defien headers for connections  | 
 | 86 | +    Map<String, String> headers1 = new HashMap<String, String>();  | 
 | 87 | +    Map<String, String> headers2 = new HashMap<String, String>();  | 
 | 88 | +      | 
 | 89 | +    //config header for connection 1  | 
 | 90 | +    headers1.put("app_id", "<your-app-id>");  | 
 | 91 | +    headers1.put("app_key", "<your-app-key>");  | 
 | 92 | +      | 
 | 93 | +    //config header for connection 2  | 
 | 94 | +    headers2.put("app_id", "<your-app-id>");  | 
 | 95 | +    headers2.put("app_key", "<your-app-key>");  | 
 | 96 | +      | 
 | 97 | +    //config connection 1  | 
 | 98 | +    conn1Config.put("baseUrl", "https://node1.mysite.com/");  | 
 | 99 | +    conn1Config.put("headers", headers1);  | 
 | 100 | +    Connection conn1 = new Connection(conn1Config);  | 
 | 101 | +      | 
 | 102 | +    //config connection 2  | 
 | 103 | +    conn2Config.put("baseUrl", "https://node2.mysite.com/");  | 
 | 104 | +    conn2Config.put("headers", headers2);  | 
 | 105 | +    Connection conn2 = new Connection(conn2Config);  | 
 | 106 | +      | 
 | 107 | +    //add connections  | 
 | 108 | +    List<Connection> connections = new ArrayList<Connection>();  | 
 | 109 | +    connections.add(conn1);  | 
 | 110 | +    connections.add(conn2);  | 
 | 111 | +    //...You can add as many nodes as you want  | 
 | 112 | +      | 
 | 113 | +    BigchainDbConfigBuilder  | 
 | 114 | +    .addConnections(connections)  | 
 | 115 | +    .setTimeout(60000) //override default timeout of 20000 milliseconds  | 
 | 116 | +    .setup();  | 
 | 117 | +      | 
 | 118 | +    }    | 
 | 119 | + | 
 | 120 | +```  | 
76 | 121 | ### Example: Prepare keys, assets and metadata  | 
77 | 122 | ```java  | 
78 | 123 | // prepare your keys  | 
 | 
0 commit comments