Coder Social home page Coder Social logo

bacwyls / go-urbit Goto Github PK

View Code? Open in Web Editor NEW

This project forked from stephenlacy/go-urbit

0.0 0.0 0.0 2.27 MB

Golang interface for Urbit

License: MIT License

Shell 0.36% C 87.58% Go 9.69% PowerShell 0.45% Nix 0.02% Makefile 0.68% QMake 0.05% M4 0.74% Roff 0.27% Meson 0.15%

go-urbit's Introduction

go-urbit

golang interface for Urbit

GoDoc

urbit example

Allows golang applications running as moons to connect to urbit ships over ames.

This can be used by any unix host, including deployed services and IoT projects.

Ames

Usage

Note: each running app must have it's own moon identity. Running on kubernetes or other systems with more than 1 replica per identity will result in odd behavior.

In your Urbit dojo generate a new moon for each connection. The output is the secret key in @ux encoding.

dojo> |moon
~tabber-finlur-litryl-tadmev
0wnXJXi.~OJWk.4aDRR.....1NEMq.p-00s.2w7U1

Convert the key to hex with `@ux` as follows:

dojo> `@ux`0wnXJXi.~OJWk.4aDRR.....1NEMq.p-00s.2w7U1
0x17.eede.d2ff.2b7a.........1022.001c.68c1.a67e.0007.0280.7e01

The output value is the seed, or secret key, for your newly created moon.

New connection

func main() {
	seed := "the hex seed"

	onPacket := func(c *Connection, pkt Packet) {
		fmt.Println("ames OnPacket", pkt.Data)
	}

	ames, err := NewAmes(seed, onPacket)
	if err != nil {
		panic(err)
	}

	to := "~your-planet"
	connection, err := ames.Connect(to)
	if err != nil {
		panic(err)
	}

	_, err := connection.Request([]string{"ge", "hood"}, "helm-hi", noun.MakeNoun("it works!"))

	if err != nil {
		panic(err)
	}
}

Noun

Most of the common urbit noun functions are available in the go-urbit/noun package

import (
	"github.com/stevelacy/go-urbit/noun"
)

func main() {
  n := noun.MakeNoun("string", 1234)
  fmt.Println(n)
}

Installation

Tested on macos M1

brew install openssl pkg-config
git clone [email protected]:bitcoin-core/secp256k1.git
cd secp256k1
./autogen.sh
./configure --enable-module-recovery --enable-module-extrakeys --enable-module-schnorrsig

make
sudo make install

If on macos M1

export PATH="/opt/homebrew/opt/openssl@3/bin:$PATH"
export CPPFLAGS="-I/opt/homebrew/opt/openssl@3/include -I/usr/local/include"
export LDFLAGS="-L/opt/homebrew/opt/openssl@3/lib -L/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/lib -L/usr/local/lib/"
export SDKROOT="/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk"
export PKG_CONFIG_PATH="/opt/homebrew/opt/openssl@3/lib/pkgconfig"


git clone [email protected]:dfoxfranke/libaes_siv.git
cd libaes_siv
cmake -DCMAKE_PREFIX_PATH=/opt/homebrew/opt/openssl@3 .
make
sudo make install

export PKG_CONFIG_PATH="/opt/homebrew/opt/openssl@3/lib/pkgconfig"
cd urcrypt/
./autogen.sh
./configure --disable-shared
make
sudo make install

Testing

export MOON_SEED="your seed"

go test ./..

TODO:

  • split each packet in CreatePacket

~litryl-tadmev

go-urbit's People

Contributors

bacwyls avatar stephenlacy 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.