This repository has been archived by the owner on Sep 9, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 33
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Add a `MachineBackend` implementation based on IPFS * Extend `test/machine-backends.rad` to test IPFS backend against real IPFS daemon * Add commands `rad-ipfs`, `rad-ipfs-daemon`, and `rad-ipfs-machine-create` Follow-up * Replace `Wreq` with `servant-client` and `ipfs-api` from https://github.com/oscoin/ipfs/tree/master/ipfs-api
- Loading branch information
Thomas Scholtes
committed
Jan 15, 2019
1 parent
9d63b9f
commit 0878b88
Showing
16 changed files
with
526 additions
and
111 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
#!/usr/bin/env bash | ||
# | ||
# Wrapper for the 'ipfs' command that talks to the IPFS daemon instance | ||
# for the Radicle network. | ||
|
||
IPFS_PATH=${IPFS_PATH:-"$HOME/.local/share/radicle/ipfs"} ipfs --api "/ip4/127.0.0.1/tcp/9301" "$@" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
#!/usr/bin/env bash | ||
# | ||
# Run the IPFS daemon with configuration for the Radicle network. | ||
|
||
set -euo pipefail | ||
|
||
export IPFS_PATH=${IPFS_PATH:-"$HOME/.local/share/radicle/ipfs"} | ||
if [[ ! -d "$IPFS_PATH" ]]; then | ||
mkdir -p "$IPFS_PATH" | ||
ipfs init | ||
cat >"$IPFS_PATH/swarm.key" <<DOC | ||
/key/swarm/psk/1.0.0/ | ||
/base16/ | ||
420076a5ac043665bf6b78ebff1bbf17b3d5b29919e38792ff3e430cf889cef8 | ||
DOC | ||
ipfs bootstrap rm all | ||
ipfs bootstrap add \ | ||
"/ip4/35.187.83.104/tcp/4000/ipfs/QmQqaBdD5g9o4L6KEtjL1RJbTSbb9gxUWgSF7FBxBqwvjr" \ | ||
"/ip4/35.187.83.104/tcp/4001/ipfs/QmVdMvYQL6WuC4uaKV39SpQfNMmEZptzf6hoXenkcHKozU" | ||
echo '{"radicle": true}' | ipfs dag put --pin | ||
fi | ||
|
||
ipfs config Addresses.API "/ip4/127.0.0.1/tcp/9301" | ||
ipfs config Addresses.Gateway "/ip4/127.0.0.1/tcp/9302" | ||
ipfs config --json Addresses.Swarm '["/ip4/0.0.0.0/tcp/9303", "/ip6/::/tcp/9303"]' | ||
|
||
ipfs daemon "$@" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
#!/usr/bin/env bash | ||
# | ||
# rad-ipfs-machine-create [local-name] | ||
# | ||
# Creates a new Radicle State Machine on IPFS and prints the machine | ||
# ID. | ||
# | ||
# If `local-name` is provided it uses this value to name the machines | ||
# IPNS key on the local IPFS daemon. By default a UUID is used. | ||
|
||
set -euo pipefail | ||
|
||
ipns_name=${1:-$(uuidgen)} | ||
empty_machine="zdpuAyyGtvC37aeZid2zh7LAGKCbFTn9MzdqoPpbNQm3BCwWT" | ||
ipns_id=$(bin/rad-ipfs key gen "$ipns_name" --type ed25519) | ||
bin/rad-ipfs name publish --key "$ipns_id" "$empty_machine" >/dev/null | ||
echo "$ipns_id" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.