Subdomain creation issue

Hi there,
I am trying to create subdomain so I set a node using blockstack-subdomain-registrar start abc.xyz then I tried to initiate request to this node using curl -X POST -H 'Content-Type: application/json' --data '{"zonefile": "$ORIGIN farouk\n$TTL 3600\n_file URI 10 1 \"file:///tmp/farouk.profile.json\"\n", "name": "farouk", "owner_address": "mhetNHR6JDGnHhxoQw8xJdxps9sNUeBH7g"}' http://localhost:3000/register/ but I got an error reply {"status":false,"message":"Failed to validate your registration request."}. Appreciate if anyone can support .

Hey @minafarouk,

Is there anything in the subdomain registrar log? The error path that leads to that message would have logged something – either to stderr, or to a file if you redirected it.

Looking at this a bit more, I see that you’re doing this in on the public testnet. I don’t think this is currently supported in the subdomain registrar. I’ll make a branch that adds support for it and post the URL here when it’s ready.

Okay, I have a pull request open on the subdomain registrar that will allow you to run it on the testnet. It’s here: https://github.com/blockstack/subdomain-registrar/pull/24

Config file I used when testing:

$ cat /tmp/subdomain-registrar.json 
{
  "winstonConsoleTransport": {
      "level": "debug",
      "handleExceptions": false,
      "timestamp": true,
      "stringify": true,
      "colorize": true,
      "json": false
  },
  "domainName": "abcdefghij.id2",
  "ownerKey": "b3ba51aa84c73d2941a944d38f221cf8cb8c0b3958194e4db850458bc9b4b9c901",
  "paymentKey": "8104d106e4f8b73c6cba0feeb681eb4f4e0682f82652804dbe331502e816d4e701",
  "batchDelayPeriod": 15,
  "checkTransactionPeriod": 5,
  "zonefileSize": 40960,
  "dbLocation": "/tmp/subdomain_registrar.db",
  "adminPassword": "foo",
  "domainUri": "http://localhost:4567",
  "resolverUri": false,
  "port": 4567,
  "ipLimit": 0,
  "apiKeys": [],
  "proofsRequired": 0,
  "disableRegistrationsWithoutKey": false,
  "nameMinLength": 1
}

Usage:

$ BSK_TESTNET=1 BSK_SUBDOMAIN_CONFIG=/tmp/subdomain-registrar.json npm run start
$ curl -X POST -H 'Content-Type: application/json' --data '{"zonefile": "$ORIGIN farouk\n$TTL 3600\n_file URI 10 1 \"file:///tmp/farouk.profile.json\"\n", "name": "farouk", "owner_address": "mhetNHR6JDGnHhxoQw8xJdxps9sNUeBH7g"}' http://localhost:4567/register/
{"status":true,"message":"Your subdomain registration was received, and will be included in the blockchain soon."}
$
$ curl http://localhost:4567/issue_batch -X POST -H 'Authorization: bearer foo'
{"status":true,"message":"Starting batch."}
$
$ curl http://localhost:4567/check_zonefiles -X POST -H 'Authorization: bearer foo'
{"status":true,"message":"Checking zonefiles."}
$
$ $ blockstack-cli -t whois farouk.abcdefghij.id2
{
  "address": "mhetNHR6JDGnHhxoQw8xJdxps9sNUeBH7g",
  "blockchain": "bitcoin",
  "did": "did:stack:v0:t94Y82Bhf6goNeCBoeU44eKQwDzTqnJSfQ-0",
  "last_txid": "dc8e61fa1c14e2ae046c85466fb5c27874ce0f0f966f56905f03342681695452",
  "status": "registered_subdomain",
  "zonefile": "$ORIGIN farouk\n$TTL 3600\n_file URI 10 1 \"file:///tmp/farouk.profile.json\"\n",
  "zonefile_hash": "93d258aac59ab048ecd5f3c7ac9fd05413c533e5"
}

I am tried but still got an error{"status":false,"message":"Failed to validate your registration request."} and you can find below my configurations and steps that I followed:
BSK_TESTNET=1 BSK_SUBDOMAIN_CONFIG=/root/subdomain-registrar2/subdomain-registrar/config.json npm run start
and config .json is
{
“winstonConsoleTransport”: {
“level”: “debug”,
“handleExceptions”: false,
“timestamp”: true,
“stringify”: true,
“colorize”: true,
“json”: false
},
“domainName”: “mina.dmaildmaildmail”,
“ownerKey”: “1cdcc5f5162077206e93e18a672e2d40de67599d6a7d85bc2e2288e09500cffc01”,
“paymentKey”: “8ad205d9c9752b776cd9803bc9bb430dabadd8d21c45b3cea482bd0e4875f27601”,
“batchDelayPeriod”: 15,
“checkTransactionPeriod”: 5,
“zonefileSize”: 40960,
“dbLocation”: “/tmp/subdomain_registrar.db”,
“adminPassword”: “ADMIN-PASSWORD”,
“domainUri”: “http://localhost:4567”,
“resolverUri”: false,
“port”: 4567,
“ipLimit”: 0,
“apiKeys”: [],
“proofsRequired”: 0,
“disableRegistrationsWithoutKey”: false,
“nameMinLength”: 1
}

I am just running curl -X POST 'http://localhost:4567/register/' and on the node I got the below
2019-07-29T15:36:52.272Z - debug: owner: undefined failed validation
2019-07-29T15:36:52.273Z - warn: Discarding operation for undefined because it failed validation.
2019-07-29T15:36:52.273Z - error: message=Requested subdomain operation is invalid., stack=Error: Requested subdomain operation is invalid.

Did you install the branch I linked?

If you don’t post a well-formed JSON body (per my example), then of course the request will fail – the registrar has no data on what name to register.