Nxt Forum

Please login or register.

Login with username, password and session length
Advanced search  

News:

Latest Nxt Client 1.11.9 - NEW RELEASE: Ardor 2.0.3e TestNet IS LAUNCHED!

Pages: [1] 2 3  All

Author Topic: NxtLib - a typed .NET API wrapper for NXT  (Read 12536 times)

NxtSwe

  • Hero Member
  • *****
  • Offline Offline
  • Posts: 658
    • View Profile
  • Karma: +121/-9
NxtLib - a typed .NET API wrapper for NXT
February 09, 2015, 10:52:05 pm

Howdy folks,

If you are using C# (or VB.NET), I've made a library that makes the json api into typed .NET objects.
It currently supports all json api functions in NRS 1.10.2 and supports .NET Framework 4.0 & 4.5 as well as .NET Platform Standard 1.3.

Supported features:
  • All 245 api functions found in Nxt core client API, with typed request/responses.
    More info on how to find the functions here.
  • Support for local signing of transactions, without having your secret phrase leave your local application.
    Sample program can be found here.
  • Support for local message encryption/decryption/compression/decompression, with full compability with NRS messages.
    Sample program can be found here.
  • Support for local token generation and decoding.
  • A Password Generator, with support for variable bit strength (128 is default). The same logic and dictionary as NRS is being used.

NxtLib makes writing code and debugging a lot easier, when it turns this:
Code: [Select]
{
  "unconfirmedBalanceNQT":"1102137300400",
  "guaranteedBalanceNQT":"1102137300400",
  "effectiveBalanceNXT":11021,
  "forgedBalanceNQT":"1800000000",
  "balanceNQT":"1102137300400",
  "requestProcessingTime":1
}

... into this:


So, if you are a .NET developer, try it out and let me know if there's any problems.

Links and stuff:
Github: https://github.com/libertyswede/NxtLib
Nuget: https://www.nuget.org/packages/NxtLib
Youtube #1: https://www.youtube.com/watch?v=jc8BqEKIRjg (video of how to check balance and send nxt using C# and NxtLib)
Youtube #2: https://www.youtube.com/watch?v=_H_xbLSSGkY (showing the local signing features in NxtLib)
« Last Edit: October 02, 2016, 04:11:42 am by NxtSwe »
Check out the NxtLib, the .NET Framework API for the Nxt platform.

EvilDave

  • Hero Member
  • *****
  • Offline Offline
  • Posts: 1791
    • View Profile
    • NXT Foundation
  • Karma: +341/-40

Whoop! Now that is a bloody good idea.....stay on it, please, mate.

Damelon and myself haven't got round to actually announcing this yet, but we'd been thinking/brainstorming about offering bounties for the creation of libraries/wrappers for the NXT API, just to make life easier for any devs who may be thinking about using NXT.

So, there will be a bounty, and I think we could also do with Python and Ruby .libs as well.....subtle hint to everyone.
More info will follow, thanks a lot! Perfect timing..... ;D
Nulli Dei, nulli Reges, solum NXT
NXT Donations: NXT-BNZB-9V8M-XRPW-3S3WD
We will ride eternal, shiny and chrome!

Damelon

  • Administrator
  • Hero Member
  • *****
  • Offline Offline
  • Posts: 2306
    • View Profile
    • Nxt Inside
  • Karma: +792/-53

Perfect timing!  ;D
Member of the Nxt Foundation | Donations: NXT-D6K7-MLY6-98FM-FLL5T
Join Nxt Slack! https://nxtchat.herokuapp.com/
Founder of Blockchain Workspace | Personal Site & Blog

jones

  • Hero Member
  • *****
  • Offline Offline
  • Posts: 1043
  • write code not war
    • View Profile
    • jNxt
  • Karma: +310/-8

What a coincedince, I also have a project going under the same name. Pretty close to finishing that one.

Mines a little different, but this one looks really cool.
-- Jones NXT-RJU8-JSNR-H9J4-2KWKY

CryptKeeper

  • Hero Member
  • *****
  • Offline Offline
  • Posts: 1229
    • View Profile
  • Karma: +77/-5

That's great and IMO he really deserves a bounty!  :)

BTW do you know that .NET exe can run on linux and mac as well? Use the mono package, it's amazing!
« Last Edit: February 10, 2015, 08:56:26 am by CryptKeeper »
Follow me on twitter for the latest news on bitcoin and altcoins!
Vanity Accounts Sale :-)

McFly

  • Jr. Member
  • **
  • Offline Offline
  • Posts: 31
    • View Profile
  • Karma: +6/-0

Hey, that's great, NXT is getting more and more interesting for me!
I currently have problems installing the NxtLib via NuGet, i am getting an error: The package "NxtLib 1.0.9"can't be installed. You are trying to use this package within a project that referenced ".NETFramework,Version=v4.5", the package doesn't include assembly references or content files that are compatible with the framework. Consult your package creator.
I already tried different .NET versions in my project, same error. I have not tried .NET4.6, do i need this?
Anyway, thanks a lot for your work!!  :)
NXT - TURNING A VISION INTO REALITY

Account RS: NXT-FLY2-LNXY-U464-AXBZL | Alias: McFly

NxtSwe

  • Hero Member
  • *****
  • Offline Offline
  • Posts: 658
    • View Profile
  • Karma: +121/-9

Thank you all for the feedback!

@EvilDave & Damelon,
Of course I'll stay on it, I have a few ideas on improvements to make it more than just a json api wrapper, but I'll announce that in due time.

@jones,
Finish it! I'm sure everyone will benefit from having more than one lib, as we will have different advantages/disadvantages.
Having same name might be a source of confusion though.  ::)

@CryptKeeper,
I've never used mono package, but I'll look into it.

@McFly,
Target framework for NxtLib is set to 4.5.1, so if you use that in your project also it should work.
But it would make sense to lower it to 4.5 as it is the version that is shipped with windows 8.
Also mono is supporting 4.5, so that's another reason to lower it.
I'll do that in next version.
Check out the NxtLib, the .NET Framework API for the Nxt platform.

NxtSwe

  • Hero Member
  • *****
  • Offline Offline
  • Posts: 658
    • View Profile
  • Karma: +121/-9

Released version 1.0.10 to nuget & github.

This was a very minor release:

* Downgraded to .NET 4.5 (from 4.5.1) to improve compability with Windows 8 users and future Mono integration.
* Added DebuggerDisplay info on Amount class
Check out the NxtLib, the .NET Framework API for the Nxt platform.

McFly

  • Jr. Member
  • **
  • Offline Offline
  • Posts: 31
    • View Profile
  • Karma: +6/-0

I'm now able to install your NxtLib with NuGet and will start some test coding soon.  :) I'll let you know the results.

Thanks for adjusting it to .NET4.5, thanks for your support, and again thanks for your work doing this! It will make life much easier while programming for NXT in C#. In case there is a bounty, i would say you definitely deserve it!
NXT - TURNING A VISION INTO REALITY

Account RS: NXT-FLY2-LNXY-U464-AXBZL | Alias: McFly

NxtSwe

  • Hero Member
  • *****
  • Offline Offline
  • Posts: 658
    • View Profile
  • Karma: +121/-9

I'm now able to install your NxtLib with NuGet and will start some test coding soon.  :) I'll let you know the results.

Thanks for adjusting it to .NET4.5, thanks for your support, and again thanks for your work doing this! It will make life much easier while programming for NXT in C#. In case there is a bounty, i would say you definitely deserve it!
You are welcome.
If you have any feedback, find bugs or suggestions, don't hesitate to post here or contact me directly.

This has been a one man project, and it's easy to become blind for flaws that are obvious to others.
Check out the NxtLib, the .NET Framework API for the Nxt platform.

slothbag

  • Sr. Member
  • ****
  • Offline Offline
  • Posts: 454
    • View Profile
  • Karma: +74/-4

Nice work NxtSwe, good to see more C# action around here :)

I'm working on various Nxt C# projects like NxtLite, BoatNET and NxtHypeDns.. I'm sure I can capitalize on NxtLib in some way or another.

alxx77

  • Full Member
  • ***
  • Offline Offline
  • Posts: 218
    • View Profile
  • Karma: +18/-4

Nice..!

For all of us M$ kidz...   ;D

NxtSwe

  • Hero Member
  • *****
  • Offline Offline
  • Posts: 658
    • View Profile
  • Karma: +121/-9

Version 1.1 released!
Release notes: https://github.com/libertyswede/NxtLib/releases/tag/v1.1.0

Along some minor updates, NxtLib now also has the ability to locally sign transactions.
It's useful if you don't have a trusted Nxt node or if you need to transmit your secret phrase via a public network.

A youtube video describing the new feature: https://www.youtube.com/watch?v=_H_xbLSSGkY
An example program (same as in the video): https://github.com/libertyswede/NxtLib/blob/master/Examples/LocalSignedAssetPurchase/Program.cs
Check out the NxtLib, the .NET Framework API for the Nxt platform.

Bik_z19

  • Jr. Member
  • **
  • Offline Offline
  • Posts: 83
    • View Profile
  • Karma: +78/-30

Just what I was looking for! Gonna give it a spin, ty!

NxtSwe

  • Hero Member
  • *****
  • Offline Offline
  • Posts: 658
    • View Profile
  • Karma: +121/-9

A new minor update released:

- Added support to locally compute account id from public key.
- Added support to locally compute account rs address from accoun id.
- Added support to locally compute account id from account rs address.
- Internal re-organization and refactoring.
- Bugfix for local signing of transactions.
- Added Android (Xamarin) support.
- Modified AccountService.GetAccountTransactions() and GetAccountTransactionIds() to accept TransactionSubType enum instead of byte values.

https://github.com/libertyswede/NxtLib/releases/tag/v1.1.1
Check out the NxtLib, the .NET Framework API for the Nxt platform.

NxtSwe

  • Hero Member
  • *****
  • Offline Offline
  • Posts: 658
    • View Profile
  • Karma: +121/-9

A new minor update released, v1.1.2:

- Bugfix for parsing transactions with encrypted messages
- Added overload for DecryptFrom that accepts EncryptedMessage for simplicity

https://github.com/libertyswede/NxtLib/releases/tag/v1.1.2
Check out the NxtLib, the .NET Framework API for the Nxt platform.

NxtSwe

  • Hero Member
  • *****
  • Offline Offline
  • Posts: 658
    • View Profile
  • Karma: +121/-9

If you want to start using NxtLib with 1.5.9, get the latest code from the branch "develop" on github.
Everything should be done except for tagged data, which I'll try to finish this week, then I'll push a new version to nuget.
Check out the NxtLib, the .NET Framework API for the Nxt platform.

NxtSwe

  • Hero Member
  • *****
  • Offline Offline
  • Posts: 658
    • View Profile
  • Karma: +121/-9

A new version is available, v1.1.3:

- Full support for NRS 1.5.9

Please note that this version is not backward compatible with older versions of NRS.

Available on nuget: https://www.nuget.org/packages/NxtLib/
And open source on github: https://github.com/libertyswede/NxtLib/releases/tag/v1.1.3
Check out the NxtLib, the .NET Framework API for the Nxt platform.

Hagbard

  • Newbie
  • *
  • Offline Offline
  • Posts: 2
    • View Profile
  • Karma: +0/-0

Hi,

is there a update planned for the NRS Version 1.5.15 or 1.6.0 (e)?

I would be grateful.  ;D

artik123

  • Jr. Member
  • **
  • Offline Offline
  • Posts: 51
    • View Profile
  • Karma: +5/-0

Hi NxtSwe,

Just saw it for the first time... Great job you did there! (very professional coding).

But I have one question:

Why didn't you use Web API?

It has a built-in json serializer/deserializer, it considered best practice today, also fully integrated with REST, and easy to consume and work with.

Pages: [1] 2 3  All