GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — First page of Bitcoin Addresses throws an error. · Issue #73 · ProgrammingBlockchain/ProgrammingBlockchain

First page of Bitcoin Addresses throws an error. #73

New issue
Copy link
New issue
Copy link
Open
Open
First page of Bitcoin Addresses throws an error.#73
Copy link

Description

@BillStrait
BillStrait
opened on Aug 6, 2017
Issue body actions

I am a dummy. I am following along with the book. In "Bitcoin Address" the chapter gives the following code examples.

Key privateKey = new Key(); // generate a random private key
PubKey publicKey = privateKey.PubKey;
Console.WriteLine(publicKey);

When executed in Visual Studio 2017 against the latest nuget package new Key(); throws this error: "You must set the RNG (RandomUtils.Random) before generating random numbers"

As a dummy, I am not sure what code needs to be added to make the example work.

Activity

  1. NicolasDorier commented on Aug 7, 2017

    @NicolasDorier
    NicolasDorier
    on Aug 7, 2017
    Collaborator
    More actions

    it should work... you created a UWP application I suppose ?

  2. NicolasDorier commented on Aug 7, 2017

    @NicolasDorier
    NicolasDorier
    on Aug 7, 2017
    Collaborator
    More actions

    See MetacoSA/NBitcoin#120 either do not created UWP application, or use the fix in the issue, or wait for october.

    If you did not created a UWP application then this is another bug. Please let me know.

  3. BillStrait commented on Aug 7, 2017

    @BillStrait
    BillStrait
    on Aug 7, 2017
    ContributorAuthor
    More actions

    This is a console application. Same problem in Visual Studio 2015. I'm on Windows 10, maybe that's the problem? Here's the entire application.

    using System;
    using NBitcoin;
    
    namespace BitcoinExperiments
    {
        class Program
        {
            static void Main(string[] args)
            {
                var privateKey = new Key();
                var publicKey = privateKey.PubKey;
                Console.WriteLine(publicKey);
                Console.ReadLine();
            }
        }
    }
    
  4. NicolasDorier commented on Aug 7, 2017

    @NicolasDorier
    NicolasDorier
    on Aug 7, 2017
    Collaborator
    More actions

    Oh shit you are right

  5. NicolasDorier commented on Aug 7, 2017

    @NicolasDorier
    NicolasDorier
    on Aug 7, 2017
    Collaborator
    More actions

    fixing it now... not normal

    Reacted by BillStrait
  6. NicolasDorier commented on Aug 7, 2017

    @NicolasDorier
    NicolasDorier
    on Aug 7, 2017
    Collaborator
    More actions

    Ok pushed new version https://www.nuget.org/packages/NBitcoin 4.0.0.14 should be indexed by nuget soon, retry soon please.

  7. NicolasDorier commented on Aug 7, 2017

    @NicolasDorier
    NicolasDorier
    on Aug 7, 2017
    Collaborator
    More actions

    Ok tested it, it works. Thanks for reporting!

  8. NicolasDorier
    closed this as completedon Aug 7, 2017
  9. BillStrait commented on Aug 7, 2017

    @BillStrait
    BillStrait
    on Aug 7, 2017
    ContributorAuthor
    More actions

    Confirmed working, thanks.

  10. mmcc1 commented on Apr 29, 2018

    @mmcc1
    mmcc1
    on Apr 29, 2018
    More actions

    This is still an issue with the recent build (4.1.1.3) and mono.

  11. nopara73
    reopened this on Apr 29, 2018
  12. NicolasDorier commented on Apr 29, 2018

    @NicolasDorier
    NicolasDorier
    on Apr 29, 2018
    Collaborator
    More actions

    strange, are you using a recent version of mono?

  13. mmcc1 commented on Apr 29, 2018

    @mmcc1
    mmcc1
    on Apr 29, 2018
    More actions

    Yes, the latest. It threw the error in a debug session of a console app. Then I ended up here looking for a resolution. It works fine in VS 2017. I just added RandomUtils.Random = new UnsecureRandom(); as a quick fix.

  14. NicolasDorier commented on Apr 29, 2018

    @NicolasDorier
    NicolasDorier
    on Apr 29, 2018
    Collaborator
    More actions

    Do you have a way to find out which DLL mono is using? I would have expected it takes .netstandard2.0 which have the Random... but if it fails it means it takes netstandard1.1 which is very strange.

  15. mmcc1 commented on Apr 30, 2018

    @mmcc1
    mmcc1
    on Apr 30, 2018
    More actions

    Its the .NET Framework version (NETFramework,Version=v4.5) 4.1.1.3.

  16. NicolasDorier commented on May 1, 2018

    @NicolasDorier
    NicolasDorier
    on May 1, 2018
    Collaborator
    More actions

    but there is no NETFramework,Version=v4.5 in the package! I think you are not using latest version of mono.

  17. NicolasDorier commented on May 1, 2018

    @NicolasDorier
    NicolasDorier
    on May 1, 2018
    Collaborator
    More actions

    Can you tell me in command line what you are doing?

  18. mmcc1 commented on May 3, 2018

    @mmcc1
    mmcc1
    on May 3, 2018
    More actions

    I pulled it apart a little and found the proper version information:

    [assembly: AssemblyVersion ("4.1.1.3")]
    [assembly: Debuggable (DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
    [assembly: AssemblyCompany ("Metaco SA")]
    [assembly: AssemblyConfiguration ("Release")]
    [assembly: AssemblyCopyright ("Copyright © Metaco SA 2017")]
    [assembly: AssemblyDescription ("The C# Bitcoin Library")]
    [assembly: AssemblyFileVersion ("4.1.1.3")]
    [assembly: AssemblyInformationalVersion ("4.1.1.3")]
    [assembly: AssemblyProduct ("NBitcoin")]
    [assembly: AssemblyTitle ("NBitcoin")]
    [assembly: CompilationRelaxations (8)]
    [assembly: InternalsVisibleTo ("NBitcoin.Tests")]
    [assembly: RuntimeCompatibility (WrapNonExceptionThrows = true)]
    [assembly: ComVisible (false)]
    [assembly: TargetFramework (".NETStandard,Version=v1.1", FrameworkDisplayName = "")]
    

    I think what happened here was that the program was originally made in VS2017, then copied to Xamarin studio and recompiled.

  19. NicolasDorier commented on May 3, 2018

    @NicolasDorier
    NicolasDorier
    on May 3, 2018
    Collaborator
    More actions

    the program is still using VS2017.
    By Xamarin Studio you mean Visual Studio for Mac ? because xamarin studio is outdated.

  20. mmcc1 commented on May 3, 2018

    @mmcc1
    mmcc1
    on May 3, 2018
    More actions

    I'm running Xamarin Studio 6.1.2 on Windows.

  21. knocte commented on May 3, 2018

    @knocte
    knocte
    on May 3, 2018
    Contributor
    More actions

    XamarinStudio is an old product that doesn't receive updates anymore. If you use Windows, use VisualStudio, if you use Mac, use VisualStudioForMac (which is based on XamarinStudio's foundation); if you use Linux, use MonoDevelop.

  22. NicolasDorier commented on May 3, 2018

    @NicolasDorier
    NicolasDorier
    on May 3, 2018
    Collaborator
    More actions

    if you don't develop for mobile apps, use Visual Studio Code and .NET Core instead of Mono.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions

      You are visitor 01402503 — GeezerVison does not store the pages you look up.
      Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.