How is content addressed and transferred in the Safenet?


#1

I have some questions as I’m unfamiliar with the SAFE network but would like to make the project I’m working on compatible with it. I am building a distributed directory on the Ethereum blockchain called Nebulis which is intended to upgrade and replace the DNS system. Nebulis IPA’s (Interplanetary Addresses) can map to a wide-variety of content-addressed protocols such as IPFS, Storj and Swarm. I’m hoping to make it compatible with Safe also.

Is the content-addressing scheme similar to IPFS in terms of length; i.e. a hash that fits into 32 bytes? What is the format that data is addressed and transferred within the network?


#2

Probably better to post the question on the developer forum - https://forum.safedev.org/


#3

Hello @physes,

the SAFE network has a built-in DNS-mechanism based on ownership of specific, decypher-able addresses in the network and their lookup. Which is also completely secured as any other content in the network – with all the properties of DDoS preventative, peer-2-peer-driven DHT lookup etc, etc…

However, to answer your specific question: Any object in the network is being addresses using so called XOR-Names – see this blog post to learn more about this – and while they are normally not shown to users (unlike the systems you mentioned), you could most certainly built your own DNS-System using them as their values. Each XORName is bound to be max 32 bytes in length, too. See the source code:

/// Constant byte length of `XorName`.
pub const XOR_NAME_LEN: usize = 32;

Cheers.


#4

Each block of data is addressed by a 256-bit hash. There are two types of data:

  • immutable data, where the address is the SHA-256 hash of the data itself
  • structured data, where the address is randomly assigned by group consensus when a client wants to create one (i.e. it’s not set by the client)

The transport itself is complicated, but that’s what the API is for.


#5

Thanks very much for your answers.

Both IPFS and SAFE have some kind of native naming scheme involved, however Nebulis is purposefully generic and is designed to be a directory which is compatible with a wide variety of transport protocols. In a single domain you can have records which could reference multiple, so you could refer to wallets, contracts, IP-addresses, content-hashes and storage associated with the same domain.

One question I have is whether there is some kind of SAFE API where you can verify whether a content-address really exists? Basically I’d like to have an “Ox Registry” where when you add a safe record, it pings the registry contract and then runs a check in the Safe network via oracle to get back a boolean for whether the record is valid. Is this currently possible within the current toolset?

Thanks again.


#6

Isn’t the DHT where that information is kept?
I don’t know if that’s accesible from the low level API though.