Reputation: 374
Just incase you're unsure of the library I'm talking about.. Click Here
Basically I'm trying to create an online wallet service but am struggling to understand how new addresses are generated for use within my wallet.
I want to create new addresses on command for my wallet, how is this possible using this library? None of the functions seem to return any sort of address for use.
Upvotes: 2
Views: 1859
Reputation: 32
Regarding this specific library and assuming that your set up is working, you can use GetNewAddress
IBitcoinService BitcoinService = new BitcoinService();
String address = BitcoinService.GetNewAddress();
Upvotes: 1
Reputation: 535
The library/wrapper you linked to requires you to run a full node and communicate via the built-in JSON RPC calls. Are you running a full synced version of bitcoin on your system?
If you have one running already, you should just have to set your bitcoin.conf file set with an RPC User and PW.
rpcuser=someusername
rpcpassword=somepassword
daemon=1
keypool=10000
prune=600 //pruning is optional but will take up a lot less disk space
maxuploadtarget=20 //optional limits total upload bandwidth
maxconnections=16 //optional limits total amount of peers that can connect
I don't know C#, but I assume there's somewhere in that wrapper that will allow you to send JSON RPC commands to.
Something like: (Again, I don't know C# this is just a guess what it might look like)
BitcoinRPC b = new BitcoinRPC(new Uri("http://127.0.0.1:8332"), new NetworkCredential("rpcuser", "rpcpass"));
Once connected you would just send JSON-RPC commands. Bitcoin Developer reference for the RPC commands (https://bitcoin.org/en/developer-reference#wallet-rpcs)
var newAddy = b.getNewAddress("label");
Upvotes: 1