Skip to content

Latest commit

 

History

History
49 lines (46 loc) · 2.14 KB

README.md

File metadata and controls

49 lines (46 loc) · 2.14 KB

Access Control For IPFS

This is an attempt to provide access control for IPFS using the ethereum blockchain.

Requirements

Compiling & Deploying The Smart Contract

  1. Smart contract (.sol) gets compiled into a golang equivalent (.go) by executing the following.
abigen --sol=Access_Control_IPFS.sol --pkg=main --out=Access_Control_IPFS.go
  1. The smart contract is deployed onto the Ethereum's Goerli test network. Infura is a service that an API to deploy & interact with your blockchain. First you need to copy an ethereum wallet's private key. This is how you can do it from metamask: https://metamask.zendesk.com/hc/en-us/articles/360015289632-How-to-Export-an-Account-Private-Key
WALLET_PRIVATE_KEY=<your wallet's private key> go run contract_deploy.go Access_Control_IPFS.go

Testing Access Control With IPFS

We need to inject the access control programming logic into the IPFS source so that it interacts with the blockchain to provide access control over various files.

Prerequisite

Install go 1.14.4:

curl -O https://storage.googleapis.com/golang/go1.14.4.linux-amd64.tar.gz
sudo tar -C /usr/local -xzf go1.14.4.linux-amd64.tar.gz
export PATH=$PATH:/usr/local/go/bin

Install build essentials:

sudo apt install build-essential

This repository is one such example, but is extremely hacky and unsuitable for stable usage at this stage: https://github.com/utkarsh23/go-ipfs

  1. Clone the above repo and change directory to the root of this repo.
git clone https://github.com/utkarsh23/go-ipfs
cd go-ipfs
  1. Execute make install.
  2. Export environment variables for ipfs.
export GOPATH=$HOME/go
export PATH=$PATH:$GOROOT/bin:$GOPATH/bin
  1. Export the WALLET_PRIVATE_KEY variable.
export WALLET_PRIVATE_KEY=<your wallet's private key>
  1. Initialize the IPFS node: ipfs init
  2. Take your node online: ipfs daemon