Home

Awesome

:bridge_at_night: IPFS Arweave Bridge

License

A bridge to connect IPFS to Arweave https://www.arweave.org/

<p align="center"> <p align="center">Click on the image to enlarge it</p> <img alt="how it looks" height="500" src="https://raw.githubusercontent.com/AndreiD/arweave-ipfs-bridge/master/assets/postman_example.png"> </p>

Features

How to use it (Ubuntu only)

Tested on ubuntu 19.04

How it does the transfer

POST /api/transfer

example: /api/transfer

output:

{
    "duration": "1.145424997s",
    "id": "Qq2IE63kxOaZp7laJapQqyu1PUPPktGoSSyKTLI9iP4",
    "payload_bytes": 14
}

POST a raw json body containing

{ "ipfs_hash": "THE_IPFS_HASH", "use_compression": BOOLEAN, "tags": [ { "key": "key1", "value": "value1" },... ] }

Where:

example:

{
    "ipfs_hash": "Qmc5gCcjYypU7y28oCALwfSvxCBskLuPKWpK4qpterKC7z",
    "use_compression": false,
    "tags": [
        {
            "key": "key1",
            "value": "value1"
        },
        {
            "key": "key2",
            "value": "value2"
        }
    ]
}

response:

(it's up to the user how often they pool for the transaction status)

Response:

{
    "duration": "1.145424997s",
    "id": "Qq2IE63kxOaZp7laJapQqyu1PUPPktGoSSyKTLI9iP4",
    "payload_bytes": 14
}

Docker

checkout the Dockerfile

docker build -t iab:1.0 .
docker run -p 5555:5555 iab:1.0

Build it

if you want to build it you need go >= 1.12 in the root directory run:

go build -o YOUR_BINARY_NAME
./YOUR_BINARY_NAME

for installing go check: https://golang.org/doc/install it should build & run without problems on macOS & Windows

Configuration file

{
  "debug": true,
  "nodeURL": "https://arweave.net",
  "ipfsGateway": "https://ipfs.infura.io/ipfs/",
  "walletFile": "/path_to_your_wallet/arweave-wallet.json",
  "cleanup": true,
  "server": {
    "host": "0.0.0.0",
    "port": 5555
  }
}

Where:

about IPFS gateway:

choices:

What if you want to host your own gateway ?

make sure you crete an api that will just accept a ipfs hash after the "/"

Other API Endpoints

:point_right: Ping

GET /api/ping

used to check if the service is alive

output:

pong

:point_right: Check your AR Token balance

GET /api/balance

returns your balance of AR Tokens

output:

{
    "ar": "0.9996836928",
    "winston": "999683692828"
}

:point_right: Retrieve a transaction or check if it's pending

GET /api/check_tx_arweave?transaction_id=TRANSACTION_ID

example: /api/check_tx_arweave?transaction_id=bnRQhVkook_lPv8uxuDRcj-wC5R2nfVps-2qA6-81WU

output:

the transaction details or it's status (ex: pending)

Other helper API calls that you might need

:point_right: Retrieve a file from IPFS

GET /api/ipfs?hash=IPFS_HASH

example: /api/ipfs?hash=QmbRmU9vYwH9Hhn1eH1WEFVS9sugpGSdJrfqtuZ329EgZA

output:

content of the file from IPFS

:point_right: Retrieve a file from Arweave

GET /api/arweave?transaction_id=TRANSACTION_ID&decode=true

example: /api/arweave?transaction_id=GyrTvuUBK9AgVLGBA8SsOHkUYmWApNqvJtMjJZZIvbQ&decode=BOOLEAN&extract=true

output:

content of the file from Arweave

Where:

:point_right: Post content directly to Arweave

POST /api/transfer_arweave

with:

{
    "payload": "CXR4SUQsIHBheWxvYWRMZW4sIGVyciA6PSBhcndlYXZlLlRyYW5zZmVyRGlyZWN0bHlBcndlYXZlKG5UcmFuc2Zlci5QYXlsb2FkLCBhclRhZ3MsIGNvbmZpZ3VyYXRpb24pCglpZiBlcnIgIT0gbmlsIHsKCQljLkpTT04oaHR0cC5TdGF0dXNCYWRSZXF1ZXN0LCBnaW4uSHsiZXJyb3IiOiBlcnIuRXJyb3IoKX0pCgkJcmV0dXJuCgl9CgoJbG9nLlByaW50ZigiVHJhbnNmZXIgdG8gQXJ3ZWF2ZSBmaW5pc2hlZCBzdWNjZXNzZnVsbHkuIFR4IElEICVzIiwgdHhJRCkKCgljLkpTT04oaHR0cC5TdGF0dXNPSywgZ2luLkh7ImlkIjogdHhJRCwgInBheWxvYWRfYnl0ZXMiOiBwYXlsb2FkTGVuLCAiZHVyYXRpb24iOiBmbXQuU3ByaW50ZigiJXMiLCB0aW1lLlNpbmNlKHN0YXJ0KSl9KQ==",
    "tags": [
        {
            "key": "key1",
            
           "value": "value1"
        },
        {
            "key2": "value2"
        }
    ]
}

Where:

Special thanks to:

https://github.com/Dev43/arweave-go -> for the transaction signing & sending code

Bugs / Features / Questions

fell free to create an issue

TODO://

Project Values

This project has a few principle-based goals that guide its development:

I welcome contributions and appreciate your efforts! However, please open issues to discuss any changes before spending the time preparing a pull request. This will save time, reduce frustration, and help coordinate the work. Thank you!

License

IPFS Arweave Bridge is released under the MIT license.