Coder Social home page Coder Social logo

gw3-sdk-go's Introduction

gw3-sdk-go

This repository contains the Golang SDK for Gateway3, an IPFS decentralized gateway. The Gateway3 SDK provides a simple and easy-to-use interface to interact with IPFS, enabling developers to build scalable and distributed applications.

Features

  • Seamless integration with IPFS network
  • Store and retrieve files on the decentralized web
  • Simplified and intuitive API
  • Built-in support for pinning
  • Secure and private data handling
  • Lightweight and highly performant

Getting Started

Prerequisites

  • Golang version 1.19 or higher

Obtain Access Key and Access Secret

To use the Gateway3 SDK, you need to obtain an access key and access secret. You can get these by logging in to the Photon Storage website at https://www.gw3.io/.

Installation

To install the Gateway3 SDK, use the following command:

go get -u github.com/photon-storage/gw3-sdk-go

Usage

Import the Gateway3 SDK in your Golang project:

import "github.com/photon-storage/gw3-sdk-go"

Here's a simple example demonstrating the usage of the Gateway3 IPFS Gateway SDK:

package main

import (
	"fmt"

	"github.com/photon-storage/gw3-sdk-go"
)

func main() {
	key := "YOUR-ACCESS-KEY"
	secret := "YOUR-ACCESS-SECRET"
	client, err := gw3.NewClient(key, secret)
	if err != nil {
		panic(err)
	}

	data := "EThe Times 03/Jan/2009 Chancellor on brink of second bailout for banks"

	// Post the data to the IPFS network, receiving a CID as a result
	cid, err := client.Post([]byte(data))
	if err != nil {
		panic(err)
	}
	fmt.Println("Data posted to IPFS network, CID is: ", cid)

	// Request the gateway to pin the CID data, ensuring its persistence
	if err := client.Pin(cid); err != nil {
		panic(err)
	}
	fmt.Println("CID data is pinned by the Gateway3")

	// Retrieve the data from the IPFS network using the CID
	got, err := client.Get(cid)
	if err != nil {
		panic(err)
	}
	fmt.Println("Data retrieved from IPFS network: ", string(got))
}

License

This project is licensed under the MIT License. See the LICENSE file for more information.

gw3-sdk-go's People

Contributors

jzhu-eth avatar maxkaneco avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.