static void Main(string[] args)
    {
        string res_as_native_dict = String.Empty;
        int    since, min_conf;
        string address;

        if (args.Length != 3)
        {
            Usage("Please enter arguments.");
        }
        if (int.TryParse(args[0], out since) == false)
        {
            Usage("Please enter a numeric argument for last known block: <block_height>");
        }
        if (int.TryParse(args[1], out min_conf) == false)
        {
            Usage("Please enter a numeric argument for min confirmations: <min_conf >");
        }
        address = args[2];

        Console.WriteLine("api_getaddresssince since " + since + " minconf=" + min_conf + " for address " + address);
        res_as_native_dict = Get_address_since(since, min_conf, address);
        Console.WriteLine(BismuthAPI.JsonDump(res_as_native_dict));
        Console.WriteLine();

        Environment.Exit(0);
    }
Ejemplo n.º 2
0
    static void Main(string[] args)
    {
        string ret = String.Empty;

        BismuthAPI connectionBismuthAPI = new BismuthAPI("127.0.0.1", 5658);

        // Ask for general status
        Console.WriteLine("statusjson:");
        ret = connectionBismuthAPI.Command("statusjson");
        Console.WriteLine(ret);
        Console.WriteLine();

        // Gets a specific block details
        Console.WriteLine("blockget(558742):");
        ret = connectionBismuthAPI.Command("blockget", 558742);
        Console.WriteLine(ret);
        Console.WriteLine();

        // Gets latest block and diff
        Console.WriteLine("difflast:");
        ret = connectionBismuthAPI.Command("difflast");
        Console.WriteLine(ret);
        Console.WriteLine();

        // Gets tx detail, raw format
        Console.WriteLine("api_gettransaction('K1iuKwkOac4HSuzEBDxmqb5dOmfXEK98BaWQFHltdrbDd0C5iIEbh/Fj', false):");
        ret = connectionBismuthAPI.Command("api_gettransaction", "K1iuKwkOac4HSuzEBDxmqb5dOmfXEK98BaWQFHltdrbDd0C5iIEbh/Fj", false);
        Console.WriteLine(ret);
        Console.WriteLine();

        // Gets tx detail, json format
        Console.WriteLine("api_gettransaction('K1iuKwkOac4HSuzEBDxmqb5dOmfXEK98BaWQFHltdrbDd0C5iIEbh/Fj', true):");
        ret = connectionBismuthAPI.Command("api_gettransaction", "K1iuKwkOac4HSuzEBDxmqb5dOmfXEK98BaWQFHltdrbDd0C5iIEbh/Fj", true);
        Console.WriteLine(ret);
        Console.WriteLine();

        // Gets addresses balances
        Console.WriteLine("api_listbalance(['731337bb0f76463d578626a48367dfea4c6efcfa317604814f875d10','340c195f768be515488a6efedb958e135150b2ef3e53573a7017ac7d'], 0, true):");
        string[] addresses = new string[] { "731337bb0f76463d578626a48367dfea4c6efcfa317604814f875d10", "340c195f768be515488a6efedb958e135150b2ef3e53573a7017ac7d" };
        ret = connectionBismuthAPI.Command("api_listbalance", addresses, 0, true);
        Console.WriteLine(ret);
        Console.WriteLine();

        // Ask for a new keys/address set
        Console.WriteLine("keygen:");
        ret = connectionBismuthAPI.Command("keygen");
        Console.WriteLine(ret);
        Console.WriteLine();
    }
    static string Get_address_since(int since, int min_conf, string address)
    {
        BismuthAPI connectionBismuthAPI = new BismuthAPI("127.0.0.1", 5658);

        // Command first
        connectionBismuthAPI.Send("api_getaddresssince");
        // Then last block
        connectionBismuthAPI.Send(since);
        // min confirmations
        connectionBismuthAPI.Send(min_conf);
        // and finally the address
        connectionBismuthAPI.Send(address);

        return(connectionBismuthAPI.Receive());
    }