Can not Perform a Remote JSON RPC on My Bitcoin Node (C #)

I'm trying to perform a remote JSON RPC. It works well using localhost but not if I try to do it from another computer.

Here is what I have until now:

                                                int index = 0;
HttpWebRequest webRequest = (HttpWebRequest) .Create ("http: // fakeip: 8332");

webRequest.Credentials = new NetworkCredential ("fakeuser", "fakepw");
/// important, otherwise the service can not wish your request correctly
webRequest.ContentType = "application / json-rpc";
webRequest.Method = "POST";

JObject joe = new JObject ();
joe.Add (new JProperty ("jsonrpc", "1.0"));
joe.Add (new JProperty ("id", "1"));
joe.Add (new JProperty ("method", "getinfo"));
// params is a collection of values ​​required by the method.
dictionary Params = new dictionary();
if (Params.Keys.Count == 0) {
joe.Add (new JProperty ("params", new JArray ()));
} other {
JArray props = new JArray ();
// add accessories in the reverse order!
for (int i = Params.Keys.Count - 1; i> = 0; i--) {
}
joe.Add (new JProperty ("params", accessories));
}

// serialize json for the query
string s = JsonConvert.SerializeObject (joe);
byte[] byteArray = Encoding.UTF8.GetBytes (s);
webRequest.ContentLength = byteArray.Length;
Stream dataStream = webRequest.GetRequestStream ();
dataStream.Write (byteArray, 0, byteArray.Length);
dataStream.Close ();

WebResponse webResponse = webRequest.GetResponse ();
Console.WriteLine (webResponse.ToString ());

which gives this exception:

                Unable to connect to remote server ---> System.Net.Sockets.SocketException:
A connection attempt failed because the connected party did not respond correctly
after a period of time or an established connection failed because the connected host
did not answer fakeip: 8332

I've also tried using curl:

                curl --user & # 39; fakeuser: fakepw & # 39; --data-binary
& # 39; {"jsonrpc": "1.0", "id": "curltext", "method": "getinfo", "params":[]} -H & # 39; happy-
type: text / plain; & # 39; http: // fakeip: 8332

curl: (7) Fakeip 8332 port connection failed: expired

My bitcoin.conf:

testnet = 0
server = 1
rpcuser = fakeuser
rpcpassword = fakepw
rpcallowip = 0.0.0.0 / 0
txindex = 1

Someone has ideas?

How to import a JSON animation file into Cocos Creator using Typescript?

I am creating a game and I want to import into the game an animation file from a remote resource using Typescript, which currently uses Xampp as a host. local. I have no problem importing this file from assets using the Cocos Creator feature, but I want to import it from a remote resource.

The original code may very well import purely PNG images into the game. However, when I want to import a json animation file, the code can not read it at all. My json animation file contains a PNG image, a json file, a text document with .atlas at the end of the file name. What is the correct syntax or code for the import?

/ **
* Configure the background of the motherboard and the leading sprite from remote resources
* /
setRemoteImageToMainboardSprites () {
if (this.mainBoardBackgroundSprite) {
RemoteResourceManager.getInstance (). SetRemoteImageToSprite (this.mainBoardBackgroundSprite, mainboard_background & # 39;);
}
if (this.mainBoardForegroundSprite) {
RemoteResourceManager.getInstance (). SetRemoteImageToSprite (this.mainBoardForegroundSprite, mainboard_foreground & # 39;)
}

}

json rpc – Bitcoin-cli can not estimate fees

I'm trying to send a transaction using bitcoin-cli but I'm constantly getting:

admin @ XXXX: ~ $ bitcoin-cli sendtoaddress "XXXXXXX" 0.1 "" "" "false true 5" ECONOMICAL "
error code: -4
Error message:
The estimate of fees failed. Fallbackfee is disabled. Wait a few blocks or activate -fallbackfee.

I do not want to set up a backup solution. I want my bitcoind company to estimate the fees based on what is currently happening on the network and my confirmation target (5 in this case).

An idea of ​​what is happening and how to solve this problem? Thank you!

P.S. My blockchain is fully synchronized.

EDIT: after some research, can blocksonly = 1 option in my bitcoin.conf be blamed? See my info mempool

bitcoin-cli getmempoolinfo
{
"size": 0,
"bytes": 0,
"use": 0,
"maxmempool": 300000000,
"mempoolminfee": 0.00001000,
"minrelaytxfee": 0.00001000
}

such empty 🙁

json rpc – Bitcoin-cli can not estimate fees

I'm trying to send a transaction using bitcoin-cli but I'm constantly getting:

admin @ XXXX: ~ $ bitcoin-cli sendtoaddress "XXXXXXX" 0.1 "" "" "false true 5" ECONOMICAL "
error code: -4
Error message:
The estimate of fees failed. Fallbackfee is disabled. Wait a few blocks or activate -fallbackfee.

I do not want to set up a backup solution. I want my bitcoind company to estimate the fees based on what is currently happening on the network and my confirmation target (5 in this case).

An idea of ​​what is happening and how to solve this problem? Thank you!

P.S. My blockchain is fully synchronized.

EDIT: after some research, can blocksonly = 1 option in my bitcoin.conf be blamed? See my info mempool

bitcoin-cli getmempoolinfo
{
"size": 0,
"bytes": 0,
"use": 0,
"maxmempool": 300000000,
"mempoolminfee": 0.00001000,
"minrelaytxfee": 0.00001000
}

such empty 🙁

java – Json conversion requires too many foreign fields

I'm currently trying to insert a career director using the C # code.
The problem is that I need to consume a java webservice that is based on a netbeans project, but so far, it's good, but when I want to insert data, json requires values ​​from foreign tables of the database, and it results in a costly task to know all the data.

For example:

The table of dogs has 3 columns, one is the id, another is the name of the dog and a foreign key of the owner.
The Json will appear on the 3 columns above, PLUS the name of the owner, his direction, his age, etc.

Enough with the example, now with the CareerDirector class:

using the system;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Net;
using System.Net.Http;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
Clases namespace
{

Public class CareerDirector
{

private int_idDirector;
private channel _mailDirector;
private string _firstnameDirector;
private string _lastnameDirector;
private int_schoolId;

    [JsonProperty("idDirector")]
    public int IdDirector {get => _idDirector; set =>
_idDirector = value; }

    [JsonProperty("mailDirector")]
    public int MailDirector {get => _mailDirector; set =>
_mailDirector = value; }

    [JsonProperty("firstnameDirector")]
    public int FirstnameDirector {get => _firstnameDirector; set =>
_firstnameDirector = value; }

    [JsonProperty("lastnameDirector")]
    public int LastnameDirector {get => _lastnameDirector; set =>
_lastnameDirector = value; }

    [JsonProperty("schoolId")]
    public int SchoolId {get => _schoolId; set =>
_schoolId = value; }

}

As you can see, I have the school identification number that is required in the database, but the Career Directors table does NOT require the name, the name of the school, or the school ID. address or values ​​of the school.

However, Json seems to need it, when I test the RESTful page on netbeans and get the career director data, they also display the school name, address, and so on.

My code used to serialize and insert something

CareerDirector directorTest = new CareerDirector ();
// Fill an object
directorTest.IdDirector = 1;
directorTest.MailDirector = "cha.heinz@director.school.com";
directorTest.FirstnameDirector = "Charles";
directorTest.LastnameDirector = "Heinz";
directorTest.SchoolId = 5;
// Convert to Json
var reg = JsonConvert.SerializeObject (directorTest);

using (client var = new WebClient ())
{
// Asign Json as a content type
client.Headers.Add (HttpRequestHeader.ContentType, "application / json");

// Insert by POST with url
client.UploadStringTaskAsync (new Uri (srl), "POST", reg);
}
// WebClient post
var httpContent = new StringContent (reg, Encoding.UTF8, "application / json");

using (var httpClient = new HttpClient ())
{
// Insert in bd
var httpresponse = httpClient.PostAsync (srl, httpContent) .Result;
var responseString = httpresponse.Content.ReadAsStringAsync ();
//Completed
}

How can I solve this problem? is there a way to avoid putting all this information to insert something into my database?
What am I doing wrong?
Thank you for your answers.

What are the advantages / disadvantages of JSON serialization with code generation on a front-end client application?

If I have an HTTP service backend that sends JSON and I'm going to create a client application that uses these services, what are the disadvantages of serializing JSON?

By JSON serialization, I mean the conversion of JSON String data into defined classes that correspond to both the server application and the client applications in their respective code languages.

In most code languages ​​such as Javascript, you can use a method like JSON.parse (myData); and you get an object or a table containing dynamic data.
If you are using ECMAScript 2015, Typescript, Dart, or other Safe Type languages, you can convert or build classes from this data.

What are the advantages and disadvantages of building classes versus dynamic objects?

Possible problems:

  • Pair server and client too tightly
  • Maintain synchronization between server and client
  • Performance

Possible benefits:

  • Auto IDE complete
  • Type of security
  • Code as documentation

json rpc – How to listerblock mempool transactions?

j & # 39; uses lists Call RPC to show me transactions related to my portfolio addresses only. Functionality absolutely useful, but I do not know how to also include mempool transactions.

Is there something that would implement such a feature?

Thank you!

json – JSONDecoder error – code revision stack exchange

enter the description of the image hereI found the code of an automated meal planner at this link (meal plan of the week), but when I run this code, errors occur and I do not know why. I am fairly new to Python, but I would like to use this code as the basis for a final meal planning program.

                "" "Program that helps you decide what to eat for the week
You should start adding some recipes and ingredients you need
for the recipe. If you have at least 7, they will be
the usual to tell you what you could cook and give you a list of groceries

The keywords are add_recipe and get_meals
"" "
import system
import getopt
import json
global import
randomly import


Using the class (exception):
def __init __ (self, msg):
self.msg = msg


def main (argv = None):
"" "Take the keywords add_recipe and get_meals and
calls the underlying functions.
"" "
if argv is None:
argv = sys.argv
try:
try:
opts, args = getopt.getopt (argv[1:]"Hamg" ["help", "add"
                                                          "get"])

except getopt.error as msg:
increase use (msg)

for o, args in opts:
print (args)
if o in ("-h", "--help"):
print ('Valid options are -a to add a recipe and -m
to get meals and -g to get meals and a list of groceries
& # 39; & # 39; & # 39;)
back 1
elif o in "-a":
save_recipe (add_recipe ())
elif o in "-m":
recipes = get_recipes ()
daily_meals = return_shuffled_max_seven (recipes)
print_meals (daily_meals)
elif o in "-g":
recipes = get_recipes ()
daily_meals = return_shuffled_max_seven (recipes)
print_meals (daily_meals)
print_grocery_list (daily_meals)
other:
increase usage ("No valid option")

except Usage as err:
print (sys.stderr, err.msg)
print (sys.stderr, "to get help --help")
back 2


def add_recipe ():
"" "Ask the user interactively to enter a recipe name
and the ingredients

Results
-------
A dictionary with the name of the recipe and the list of ingredients

Example
-------
"Apple pie":['Apple','Pie']}
"" "
print ("Name of the recipe  n")
name = entry (">")
recipe = []
    while true:
print ("Add the ingredients or finalize the recipe with" q ")
ingredients = entry (">")
if ingredients in 'q':
Pause
other:
recipe.append (ingredients)
returns {name: recipe}


def save_recipe (recipe):
"" "Saves the recipe to a json file" ""

# Get the first dictionary key: Name of the recipe
name = next (iter (recipe.keys ()))
with open (name + 'recipe', 'w') like f:
json.dump (recipe, f, indent = 1)


def get_recipes ():
"" "Gets all the recipes and returns them in the form of a list" ""
grand_list_of_recipes = []
    for the recipe in glob.glob ("*. recipe"):
with open (recipe, & rsquo;) as f:
grand_list_of_recipes.append (json.load (f))
return grand_list_of_recipes


def return_shuffled_max_seven (a_list):
"" "Returns 7 elements from a list" ""
random.shuffle (a_list)
return a list[:7]


def print_meals (daily_meals):
"" "Print a weekly plan for meals" ""
week = []
    for meals in weekly meals:
name = next (iter (meal.keys ()))
week.append (name)
if len (week) <7:
print ("You only have" + str (len (week)) + "recipes")
for i in the beach (7-len (week)):
week.append (& # 39;)

print ("Monday:")
print (+ # + str (weekends)[0]) + & # 39;  n & # 39;)
print ("Tuesday:")
print (+ # + str (weekends)[1]) + & # 39;  n & # 39;)
print (on wednesday: & # 39;)
print (+ # + str (weekends)[2]) + & # 39;  n & # 39;)
print ("Thursday:")
print (+ # + str (weekends)[3]) + & # 39;  n & # 39;)
print ('friday: & # 39;)
print (+ # + str (weekends)[4]) + & # 39;  n & # 39;)
print (on Saturday: & # 39;)
print (+ # + str (weekends)[5]) + & # 39;  n & # 39;)
print ('sunday: & # 39;)
print (+ # + str (weekends)[6]) + & # 39;  n & # 39;)


def print_grocery_list (daily_meals):
"" "Print the grocery list" ""
meal = []
    for meals in weekly meals:
name = next (iter (meal.keys ()))
meal.learn (name)

recipe_list = []
    for idx, meals to enumerate (meals):
recipe_list.append (daily_meals[idx][meal])

grocery_list = set ()
for the ingredients in recipe_list:
grocery_list.update (ingredients)
print ("Shopping List:  n")
for the ingredient in the grocery list:
print ("* {}  n" .format (ingredient))


if __name__ == __ hand __:
sys.exit (main ())

Any help would be appreciated! I would also like to take a tip on simplifying / configuring this code to email both the grocery list and the weekly meal schedule. Thank you!

How to make sure that a URL returns a dynamic JSON with a custom content type?

Some antecedents first, I try to follow the instructions here:

https://developer.apple.com/library/archive/documentation/General/Conceptual/AppSearch/UniversalLinks.html#//apple_ref/doc/uid/TP40016308-CH12-SW1

get universal links working with my website for iOS devices. My wordpress site is in a shared hosting environment, so I do not have access to the server or any root files. I placed the file at the root of my site (httpdocs) and when I navigate to the page, it does not load. While searching on Google, I found a stackoverflow article indicating that you need to configure the server to allow it to serve this file with a type of content of type "application / pkcs7-mime" (Apple-app-site Config file -association with wordpress). As mentioned, I do not have access to that.

I have a subdomain which is a Microsoft Web API project that I know very well. I created an endpoint for "apple-app-site-association" and dynamically created the JSON response in the code, then set the content type and returned it. It ended up working and Apple detects it and everything. This is interesting because I do NOT need a file on my server because I generate it on the fly, and I do not need to change anything in terms of server.

The problem though is that I need the primary site domain to be the universal link, not the Windows subdomain. The main site is wordpress. I think it's possible to do the same thing in wordpress when I navigate to mydomain.com/apple-app-site-association and I generate the json and type of content on the fly and serve.

I have never coded with wordpress and I do not even know where to start.

If possible, I would like to have clear guidelines on the following:

  1. Make mydomain.com/apple-app-site-association lead to a custom function or a page used as a json.
  2. Have a code that makes the JSON be served dynamically.
  3. Have code that defines the content type of the response on "application / pkcs7-mime".

Of course, if anyone knows how to resolve the file not receiving a shared server without this method, I am also open to that. From what I can see, this is perhaps the only way to assume that this can be done.

java – Get JSON composed of tables with Retrofit 2 and Android

I am trying to create an application in Android Studio and I want to use a recipe to cook, here is the answer of the API that I consume with Android Studio and Java:

                {
"q": "chicken",
"from": 0,
"to": 10,
"params": {
"cure": [ ],
"Q": [ "pollo" ],
"App_id": [ "02" ],
"App_key": [ "n66b" ]
  }
"more": true,
"account": 1000,
"Hits":[{
"recipe": {
"uri": "http://www.edamam.com/ontologies/edamam.owl#recipe_d56f75c72ab67a45174441af1efe4473",
"label": "Chicken with herbs cream",
"image": "http://cdn.kiwilimon.com/recetaimagen/23127/thumb120x90-15802.jpg",
"source": "KiwiLimon",
"url": "http://www.kiwilimon.com/receta/carnes-y-aves/pollo-con-crema-a-las-hierbas",
"shareAs": "http://www.edamam.com/recipe/pollo-con-crema-a-las-hierbas-d56f75c72ab67a45174441af1efe4473/pollo",
"yield": 42.0,

And continue with more 'recipe', what I want is to get only the number of hits that all the recipes must be able to display in my application, the problem is that I get the following error:

BEGIN_ARRAY expected but BEGIN_OBJECT at line 1 column 2 path $

I understand it's because it's waiting for a table and getting a JSON object, but I do not know how to parse it, I have my Recipe template class and the RecipeService service and I handle everything in MainActivity. I have seen in some answers that I should make an intermediate response, but I do not understand how I could implement it in my code, so I show the classes that handle all that.

Recipe:

public class Recipe {
private channel label;
private channel image;
private chain source;
private String shareAs;
private list dietLabels;
private list health tags;
private list warnings;
private list line of ingredients;
private list Ingredients;
double private calories;
double private totalWeight;
private list totalNutrients;
private list totalDaily;

public String getLabel () {
return label;
}
.
.
.

RecipeService:

                public interface RecipeService {

String API_ROUTE = "/ search";
String API_KEY = "& app_key =" + Credentials.API_KEY;
String APP_ID = "& app_id =" + Credentials.APP_ID;
// String query = "";

@GET (API_ROUTE)
Call <list > getRecipe (@Query ("q") String q);

}

MainActivity:

    private void getRecipes () {
Retrofit Retrofit = new Retrofit.Builder ()
.baseUrl ("https://test-es.edamam.com")
.addConverterFactory (GsonConverterFactory.create ())
.build ();

RecipeService recipeService = retrofit.create (RecipeService.class);
Call <list> call = recipeService.getRecipe ("chicken");

System.out.println ("GET RECIPES");
System.out.println ("HEADERS:" + call.request (). Headers ());

call.enqueue (new Callback <List> () {
@Override
public void onResponse (Call <List> call, answer <list> answer) {

System.out.println ("ANSWER CODE:" + response.code ());
for (recipe recipe: response.body ()) {

System.out.println ("ADDING:" + recipe.getLabel ());
recipes.add (recipe.getLabel ());
}
//System.out.printlnnrecipes.toArray (). ToString ());
}

@Override
public void onFailure (Call <List> call, Throwable t) {
System.out.println ("AN ARRIVAL FAULT");
System.out.println (t.getMessage ());
}
});
}