REST API

biolizard89
Posts: 2001
Joined: Tue Jun 05, 2012 6:25 am
os: linux

Re: REST API

Post by biolizard89 »

indolering wrote:Honestly, I don't see a whole lot of demand for a REST api, I wouldn't put too much effort into it.
The REST API is potentially easier for NMControl to access, and can be accessed by untrusted users. So I'd say that's a decent amount of demand.
Jeremy Rand, Lead Namecoin Application Engineer
NameID: id/jeremy
DyName: Dynamic DNS update client for .bit domains.

Donations: BTC 1EcUWRa9H6ZuWPkF3BDj6k4k1vCgv41ab8 ; NMC NFqbaS7ReiQ9MBmsowwcDSmp4iDznjmEh5

indolering
Posts: 801
Joined: Sun Aug 18, 2013 8:26 pm
os: mac

Re: REST API

Post by indolering »

biolizard89 wrote:
indolering wrote:Honestly, I don't see a whole lot of demand for a REST api, I wouldn't put too much effort into it.
The REST API is potentially easier for NMControl to access, and can be accessed by untrusted users. So I'd say that's a decent amount of demand.
I thought we were going to remove the username/password requirements for read only calls?
DNS is much more than a key->value datastore.

biolizard89
Posts: 2001
Joined: Tue Jun 05, 2012 6:25 am
os: linux

Re: REST API

Post by biolizard89 »

@indolering REST is still much simpler to code for than JSON-RPC. Look at the comparative curl commands.

@domob If we're going to implement name_filter for REST, I would also favor a new command which does a prefix-based search (rather than RegExp), for improved speed. name_filter is horribly slow.

Here's an interesting security question. The Bitcoin Core documentation says that REST is dangerous for privacy if run on the same machine as a web browser: https://github.com/bitcoin/bitcoin/blob ... e.md#risks . To my knowledge, this is false, because the same-origin policy will prevent a website not running on localhost from retrieving data except by <script>, and Bitcoin Core doesn't return JSONP (at least, it doesn't document doing so), so a <script> element will fail to load. Is there something I'm missing here?
Jeremy Rand, Lead Namecoin Application Engineer
NameID: id/jeremy
DyName: Dynamic DNS update client for .bit domains.

Donations: BTC 1EcUWRa9H6ZuWPkF3BDj6k4k1vCgv41ab8 ; NMC NFqbaS7ReiQ9MBmsowwcDSmp4iDznjmEh5

domob
Posts: 1129
Joined: Mon Jun 24, 2013 11:27 am
Contact:

Re: REST API

Post by domob »

biolizard89 wrote:@domob If we're going to implement name_filter for REST, I would also favor a new command which does a prefix-based search (rather than RegExp), for improved speed. name_filter is horribly slow.
Sounds reasonable. From the RPC perspective, you can do that already "somewhat" with name_scan. (Not sure why everyone is using name_filter, I think that name_scan is very powerful and much more efficient as well for a lot of things.) But it also makes sense to make this accessible from REST.

However, a big problem I see with this: Due to the way that Bitcoin's serialisation works, strings are sorted internally in the DB in a strange way. In particular, all short names come before any longer names. (Because the string length is serialised first, and LevelDB then just compares the byte arrays to build its search tree.) This, unfortunately, interferes with fast prefix-lookups. A possible solution is to perform lookups of the prefix with all possible suffix lengths, which should still be much faster than running through all names in the DB.
BTC: 1domobKsPZ5cWk2kXssD8p8ES1qffGUCm | NMC: NCdomobcmcmVdxC5yxMitojQ4tvAtv99pY
BM-GtQnWM3vcdorfqpKXsmfHQ4rVYPG5pKS
Use your Namecoin identity as OpenID: https://nameid.org/

Post Reply