Project on hold, see npm on ipfs
A blockchain registry for the interplanetary package manager tool
As with ippm, ippm-registry is Alpha Quality. It's not perfect yet. The contract for the registry currently only resides on a test net but will be moved to the main chain when tested or if interest is shown. It will cost a small amount of money to publish while reading and searching the registry will always be free. All publish fees go to the blockchain miners to set the registration.
There is a react application distributed with ipfs that demos an interface with the registry contract with a testnet hosted in California. You can access the app by running a local go ipfs or js-ipfs node and view that hash through your gateway at http://localhost:8080/ipfs/QmSGXf6KXUZFUspCArTnLeYWm8dRK8cYiahcD8rLcbeY6b
The goal of using a blockchain is to track the head of a list of published packages. This uses ipfs-ethereum-log to accomplish this.
The blockchain used for gx-registry is Ethereum. The source code is in /contracts/Registry.sol
. The ethereum EVM provides a good scripting platform for code execution in blocks but it is not the only option and can be swapped out in the future if needed.
The contract will register the msg.sender
public key with the provided human readable names. Currently only the public key that initialized the registry of the package will be able to edit the link to packages.
gx-registry uses an append only log to store the registrations. Each node in the list is a mapping from <key> name => <struct> IPFS
where IPFS
is a struct memory block containing the ipfs hash of the repository and any other desired meta information.
The combination of recording the state update operations in the log and storing the state in content addressable ipfs objects allows for state updates to be broadcast to clients at approcimately the speed of the block confirmation on the blockchain running the log.
to interface with the log, load the contract abi and instantiate with the contract address. Currently the registry is running on a test net. ABI can be found at /contracts/RegistryABI.js
var registryContract = ABI
var regInstance = eth.contract(ABI).at(Address)
regInstance.init(name, multihash)
Where
- String name, is the gx package name
- String multihash, the base58 encoded version of the multihash
The public key used in the signing of the init transaction will be given ownership of the node added to the linked list. From this point on only that public key can change the data in the node.
regInstance.publish(name, multihash)
Where
- String name, is the gx package name
- String multihash, the base58 encoded version of the multihash
The log is set to only allow the public key that initialized the entry to be able to publish new information to it.
regInstance.size()
Returns an interger number of packages regiestered in the log
regInstance.head()
Returns the key for the element at the head of the linked list
regInstance.tail()
Returns the key for the element at the tail of the linked list
regInstance.registry(key)
Where
- key is a string value representing the package name
- Returns an array struct with values
- next: key of the next element in the list
- previous: key of the previous element in the list
- hash: the ipfs multihash of the package
More fields can be added to the struct like a version number in the future
- integrate with go-gx
- publish repo hashs from go-gx command line
- integrate with npm-registry @diasdavid
- integrate js-ipfs into web app
- Serve app through js-ipfs in browser
- Create upload a repo
- Add information page hash to registry meta info