Pages:
Author

Topic: [C#] Watch Only Bitcoin Wallet. Support SegWit and Forks (V3.1) - page 2. (Read 17017 times)

newbie
Activity: 7
Merit: 0
Excellent project for learning.

On a side note; I have been using this web based tool to keep track of my paper wallets across multiple forks. No private keys and looks perfect on my phone. It also links out to the chain's corresponding explorer for further balance verification.

WalletChecker.com
newbie
Activity: 28
Merit: 0
Good job! Keep it up! Thank you for building a tool for the convenience of others Smiley
legendary
Activity: 1042
Merit: 2805
Bitcoin and C♯ Enthusiast
Released version 2.4.0
  • Added a new property called TransactionList and a new window for updating it and showing the balance on a given block height. This is useful for checking how much you owned when a forks like Bitcoin Cash, Bitcoin Gold,... happened.
legendary
Activity: 1042
Merit: 2805
Bitcoin and C♯ Enthusiast
Released a small version 2.2.1 (2017-12-9)
  • Replaced blockr API with blockexplorer

Released version 2.3.0
  • Added color codes to balance column (green: increased balance, red: decreased!)
legendary
Activity: 1042
Merit: 2805
Bitcoin and C♯ Enthusiast
Released version 2.2.0
  • A lot of small code improvements
  • Exceptions are handled and a couple of bugs fixed
  • The Error MessageBox is now hidden and will only appear if there is an error
  • Added a new StatusBar at the bottom of the window
  • Added a new API service for fetching balances (blockr.io)
  • The balance now has a ToolTip showing the difference each time balance is updated
  • Important: Wallet file is not stored in JSON format which makes this new version backward incompatible. This new format reduces the wallet file size a lot and is easier to use.
  • Saving is now completely automatic!
legendary
Activity: 1042
Merit: 2805
Bitcoin and C♯ Enthusiast
Released a new version (2.1.0) with so many code improvement, mostly removed the extra assemblies and now only have two main assemblies.
Also improved the SettingsWindow and its interaction.
legendary
Activity: 1042
Merit: 2805
Bitcoin and C♯ Enthusiast
Fixed a bug with Price services and released version 2.0.0 by merging the MVVM branch.
hero member
Activity: 854
Merit: 658
rgbkey.github.io/pgp.txt
This is a nice project, I can respect your enthusiasm for coding. Remember that the more often you do it, the faster you'll get better.
legendary
Activity: 1042
Merit: 2805
Bitcoin and C♯ Enthusiast
Version 2.0.0 is complete, and will be merged as soon as I find some time to test it (It has been a busy month).

https://github.com/Coding-Enthusiast/Watch-Only-Bitcoin-Wallet/tree/MVVM

*click to view full size*

Included in this version:
  • Code is following the MVVM pattern!
  • Every bitcoin address is checked to make sure it is a valid base58 address
  • GUI changed to GridView to make Add/Edit/Remove Function easier
  • MainWindow now has hotkeys for Saving (Ctrl+S), Opening Settings (F2), Opening Help (F1)
  • Added a new option in SettingsWindow to get bitcoin price from 2 different exchanges (bitfinex and btc-e)

As always feel free to leave any suggestion, feedback, request,... here or on GitHub.
legendary
Activity: 1042
Merit: 2805
Bitcoin and C♯ Enthusiast
@doof Thanks a lot for your feedback.

If  you have an enum, use it instead of a string in the get method.  Thats what its for.

I am still new to C♯ and definitely to MVVM and the reason why I did that was because I got an error in my view (MainWindow) xaml file which was unable to resolved the dependency! This and some other bugs/problems are the reason why I have not yet merged that branch.

But I like the follow up about open/closed principle after reading more about it.
So should it be like this:
In ViewModel:
Code:
....
if(//bitfinex is selected)
   IPriceClient MyClient = new BitfinexService();
else if (//some other one is selected)
   IPriceClient MyClient = new SomeOtherService();
.....
price = Myclient.GetPriceAsync();
In Services:
Code:
public class BitfinexService : ...
...
public class SomeOtherService : ...
hero member
Activity: 765
Merit: 503
Couple of things:  With the class https://github.com/Coding-Enthusiast/Watch-Only-Bitcoin-Wallet/blob/MVVM/WalletServices/PriceServices.cs

If  you have an enum, use it instead of a string in the get method.  Thats what its for.

Code:
public static async Task GetPrice(ServiceNames serviceName)

Doing that will prevent the need for this.

Code:
default:
                    price = 0;
                    break;

You shouldn't really do that anyway.  The caller should be treating your method as a black box. If the service doesnt exist, throw an exception.  Don't give the user a heart attack and return a 0 price!

Using a switch statement also means you violate the open closed principal.  You should really use an Interface and have concrete types of "BitFinex" ect.  Which will enable you to mock the call in your unit tests.  Also, the convention is to name async method with async.

Code:
   public interface IPriceClient
    {
        Task GetPriceAsync();
    }

Code:
namespace WalletServices
{
    public class BitfinexService : ApiCall, IPriceClient
    {
        public async Task GetPriceAsync()
        {
            JObject jResult = await GetApiResponse("https://api.bitfinex.com/v1/pubticker/btcusd");
            decimal price = (decimal)jResult["last_price"];

            return price;
        }
    }
}
staff
Activity: 3500
Merit: 6152
A feature that would be nice to add is when you receive a transaction, It keeps the current price and also  the real-time price. It could be really useful to know how much Bitcoin was worth it in the past and compared to now. Columns should look something like this. (also USD balance should be in the GridView) and settings should allow users to choose what currency they want (USD , EURO , etc.. )

Quote
Name | Address | Balance | USD Balance | Worth when received funds


For that I am going to need access to price history of each hour or at least a medium price of days. I can't find this on Bitfinex API nor on Btc-e. Did not check any other place for price history though.

I will think about adding a new column for Balance in USD

I don't think that's going to be needed , I explained the idea wrong , the "Worth when received funds" should be available in each transaction (If you are going to implement transactions of each address) and not the whole address as they funds are received in different periods so that make it impossible to calculate .

It's possible to make a local database (.XML or SQLite for example) , once the address you are watching receive a transaction you store the price (of that real-time in the database) , So In the GridView , when you see the transaction "Worth when received funds" should be taken from the local database and "Real time" balance should be taken from Blockchain API or somewhere else.
legendary
Activity: 1042
Merit: 2805
Bitcoin and C♯ Enthusiast
A feature that would be nice to add is when you receive a transaction, It keeps the current price and also  the real-time price. It could be really useful to know how much Bitcoin was worth it in the past and compared to now. Columns should look something like this. (also USD balance should be in the GridView) and settings should allow users to choose what currency they want (USD , EURO , etc.. )

Quote
Name | Address | Balance | USD Balance | Worth when received funds


For that I am going to need access to price history of each hour or at least a medium price of days. I can't find this on Bitfinex API nor on Btc-e. Did not check any other place for price history though.

I will think about adding a new column for Balance in USD
staff
Activity: 3500
Merit: 6152
A feature that would be nice to add is when you receive a transaction, It keeps the current price and also  the real-time price. It could be really useful to know how much Bitcoin was worth it in the past and compared to now. Columns should look something like this. (also USD balance should be in the GridView) and settings should allow users to choose what currency they want (USD , EURO , etc.. )

Quote
Name | Address | Balance | USD Balance | Worth when received funds
legendary
Activity: 1042
Merit: 2805
Bitcoin and C♯ Enthusiast
Nice project.
I have some suggestions here:
- maybe add a recent bitcoin price will be great.
- I want it in android version so bad Cheesy
- notification when a transaction come.

- Already made possible from the Settings Window, using bitfinex and btc-e APIs:

- Maybe someday Wink
- This is possible with a WebSocket API which I think Blockchain.info has. So i guess that can be done but for the next version.
legendary
Activity: 1106
Merit: 1000
Nice project.
I have some suggestions here:
- maybe add a recent bitcoin price will be great.
- I want it in android version so bad Cheesy
- notification when a transaction come.
legendary
Activity: 1042
Merit: 2805
Bitcoin and C♯ Enthusiast
Version 2 is getting ready for release:

Major new features:
  • Code is following the MVVM pattern now
  • The wallet GUI is using the GridView which gives a more excel like view making it easier to add/edit/remove items.
  • Input validation is added to prevent user from entering an invalid bitcoin address

I want to work a little bit more on the code so I am still not merging this with the main branch. But you can see the development on the MVVM branch
Feel free to give me any suggestions or requests. 
full member
Activity: 1498
Merit: 146
I've used Xamarin in the past. It does it's job, sure. The one problem I have with it would be the huge payload for such small apps. You're looking at around 5mb payload before you even write a single line of code.
staff
Activity: 3500
Merit: 6152
Good job. Perhaps you can create an android version too.

Thanks.
I have it in my future plans, but the problem is I don't have an android so it would be a bit hard for me to test since I have never done it before, but I will do it eventually.

Since you are writing using C# , you could use Xamarin [ http://xamarin.com/ ] (for both Android & iOS) and you don't have to own an android phone , Visual studio will allow you to run an Android emulator once you execute the code and you could test everything on it (It's going to require a decent RAM & CPU).
hero member
Activity: 1162
Merit: 547
CryptoTalk.Org - Get Paid for every Post!
Good job. Perhaps you can create an android version too.

Thanks.
I have it in my future plans, but the problem is I don't have an android so it would be a bit hard for me to test since I have never done it before, but I will do it eventually.

Don't worry if you don't have android device, you can still test and run your app on android emulator on a pc.
Android studio by google, bluestacks, leapdroid are some of the emulators.
Pages:
Jump to: