Example 1: HGJ
{"$id":"1","Accs":[],"Advances":[],"Sells":[],"Arthi":{"$id":"2","Buyers":[{"$id":"3","Sells":[],"BuyerAccs":[],"Arthi":{"$ref":"2"},"B_id":18,"B_Name":"asd","B_Cnic":"3123","B_Contact":"13123","B_Image":"dry.jpg","B_Email":"a","B_Password":"123","A_Email":"[email protected]"}],"Farmers":[{"$ref":"1"}],"Products":[{"$id":"4","Sells":[],"Arthi":{"$ref":"2"},"P_id":63,"P_Name":"sabzi","Farmer":"umer","buyer":null,"P_Type":"bori","P_Quantity":11,"P_Image":"dry.jpg","A_Email":"[email protected]"},{"$id":"5","Sells":[],"Arthi":{"$ref":"2"},"P_id":64,"P_Name":"karaila","Farmer":"hamza","buyer":null,"P_Type":"bori","P_Quantity":12,"P_Image":"dry.jpg","A_Email":"[email protected]"}],"A_id":2,"A_Name":"wajhat","A_Email":"[email protected]","A_Password":"123"},"F_id":47,"F_Name":"wajahat","F_Cnic":"123","F_Contact":"1","F_Image":"dry.jpg","F_Address":null,"A_Email":"[email protected]"}
Example 2: hgj
$ node tomas.js JbTDjtUkvWS4c3mgAtJf4zKyRGzdQzZacfx2S7gRqPLcbeAWaSDEnazFJF6mKbzBvY1ZRwZCbvT
Joined My Wallet!
Wallet Info: [...]
Creating first address:
Return: [...]
Example 3: hgj
$ node irene.js
info Generating new keys
Wallet Created. Share this secret with your copayers: JbTDjtUkvWS4c3mgAtJf4zKyRGzdQzZacfx2S7gRqPLcbeAWaSDEnazFJF6mKbzBvY1ZRwZCbvT
Example 4: hgj
npm i bitcore-wallet-client
Example 5: hgj
var Client = require('bitcore-wallet-client');
var fs = require('fs');
var BWS_INSTANCE_URL = 'https://bws.bitpay.com/bws/api'
var secret = process.argv[2];
if (!secret) {
console.log('./tomas.js <Secret>')
process.exit(0);
}
var client = new Client({
baseUrl: BWS_INSTANCE_URL,
verbose: false,
});
client.joinWallet(secret, "Tomas", {}, function(err, wallet) {
if (err) {
console.log('error: ', err);
return
};
console.log('Joined ' + wallet.name + '!');
fs.writeFileSync('tomas.dat', client.export());
client.openWallet(function(err, ret) {
if (err) {
console.log('error: ', err);
return
};
console.log('\n\n** Wallet Info', ret); //TODO
console.log('\n\nCreating first address:', ret); //TODO
if (ret.wallet.status == 'complete') {
client.createAddress({}, function(err,addr){
if (err) {
console.log('error: ', err);
return;
};
console.log('\nReturn:', addr)
});
}
});
});
Example 6: hgj
var Client = require('bitcore-wallet-client');
var fs = require('fs');
var BWS_INSTANCE_URL = 'https://bws.bitpay.com/bws/api'
var client = new Client({
baseUrl: BWS_INSTANCE_URL,
verbose: false,
});
client.createWallet("My Wallet", "Irene", 2, 2, {network: 'testnet'}, function(err, secret) {
if (err) {
console.log('error: ',err);
return
};
// Handle err
console.log('Wallet Created. Share this secret with your copayers: ' + secret);
fs.writeFileSync('irene.dat', client.export());
});