Go-sbot blobs usage #21

Open
opened 2022-01-18 14:48:00 +00:00 by glyph · 3 comments
Owner

CC: @notplants

I'm pasting here what @cblgh had to say about blobs in cabal:

i don't really remember what the issues we had with blobs was, but here's how you can do some basic stuff with it using sbotcli

[cblgh@howl]$ ./sbotcli blobs --localstore "~/.ssb-go/blobs" add blob-ul.txt
before=blobs locl=null
blobs.add="&skEdYtad6Ytg87x7u0h1LEe29LwUy/MC9oWofg4TUBY=.sha256"

i.e. you gotta pass the --localstore flag, and it has to point to the blobs folder of the running sbot

i.e. if you start a go-sbot with --repo "/var/ssb", then the blobs flag should be --localstore "/var/ssb/blobs", apparently

get works too, but has looks buggy

fixed the apparent error with has, hard to verify with a shitty bot tho ^^. i get what seems like a false negative tho

CC: @notplants I'm pasting here what @cblgh had to say about blobs in cabal: > i don't really remember what the issues we had with blobs was, but here's how you can do some basic stuff with it using sbotcli ```shell [cblgh@howl]$ ./sbotcli blobs --localstore "~/.ssb-go/blobs" add blob-ul.txt before=blobs locl=null blobs.add="&skEdYtad6Ytg87x7u0h1LEe29LwUy/MC9oWofg4TUBY=.sha256" ``` > i.e. you gotta pass the --localstore flag, and it has to point to the blobs folder of the running sbot > > i.e. if you start a go-sbot with --repo "/var/ssb", then the blobs flag should be --localstore "/var/ssb/blobs", apparently > > `get` works too, but `has` looks buggy > > fixed the apparent error with `has`, hard to verify with a shitty bot tho ^^. i get what seems like a false negative tho
Author
Owner

Further notes from testing:

Once the add command has been executed (documented above), it returns a reference to the blob. This can then be used to compose and publish an about message:

./sbotcli publish about --image "&JlJHc9yeG1EpZA9fIPGLzUKDH0FeR39Ai57euhKT1G8=.sha256" "@Sih4JGgs5oQPXehRyHS5qrYbx/0hQVUqChojX0LNtcQ=.ed25519"

Note that the ordering of the arguments is very important here, as are the inverted-commas (") around the references. The command will fail if the inverted-commas are ommitted.

Further notes from testing: Once the `add` command has been executed (documented above), it returns a reference to the blob. This can then be used to compose and publish an `about` message: ```shell ./sbotcli publish about --image "&JlJHc9yeG1EpZA9fIPGLzUKDH0FeR39Ai57euhKT1G8=.sha256" "@Sih4JGgs5oQPXehRyHS5qrYbx/0hQVUqChojX0LNtcQ=.ed25519" ``` Note that the ordering of the arguments is very important here, as are the inverted-commas (`"`) around the references. The command will fail if the inverted-commas are ommitted.
Member

publishing an about with the image

./sbotcli publish about --image "&skEdYtad6Ytg87x7u0h1LEe29LwUy/MC9oWofg4TUBY=.sha256" "@767fbfkQ7LUyNpXuR4uwvlAry+X8xSJ7CM3nNhjIrwI=.ed25519"  

notes:

  • quotes around base64 input is important
  • the order of args is important for golang binaries: always, always flags before any final flagless arguments
  • adjust the blob ref passed with --image to your blob ref from ./sbotcli blobs add :)
publishing an about with the image ```sh ./sbotcli publish about --image "&skEdYtad6Ytg87x7u0h1LEe29LwUy/MC9oWofg4TUBY=.sha256" "@767fbfkQ7LUyNpXuR4uwvlAry+X8xSJ7CM3nNhjIrwI=.ed25519" ``` **notes**: * quotes around base64 input is important * the order of args is important for golang binaries: always, always flags before any final flagless arguments * adjust the blob ref passed with `--image` to your blob ref from `./sbotcli blobs add` :)
Author
Owner

Latest working commands, using sbotcli-getsubset branch:

./sbotcli blobs add ~/Pictures/chiku.jpg
# before=blobs locl=null
# blobs.add="&JlJHc9yeG1EpZA9fIPGLzUKDH0FeR39Ai57euhKT1G8=.sha256"

./sbotcli publish about --image "&JlJHc9yeG1EpZA9fIPGLzUKDH0FeR39Ai57euhKT1G8=.sha256" "@Sih4JGgs5oQPXehRyHS5qrYbx/0hQVUqChojX0LNtcQ=.ed25519"
# level=info client=connected method="unix sock"
# event=published type=about ref="%6J74ZUhsz+avbXn/vAOL5tnj/LnuwFDmr5hgQDTYYMk=.sha256"
# %6J74ZUhsz+avbXn/vAOL5tnj/LnuwFDmr5hgQDTYYMk=.sha256

./sbotcli blobs has "&JlJHc9yeG1EpZA9fIPGLzUKDH0FeR39Ai57euhKT1G8=.sha256"
# before=blobs locl=null
# level=info client=connected method="unix sock"
# event=blob.has r=true

./sbotcli blobs get "&JlJHc9yeG1EpZA9fIPGLzUKDH0FeR39Ai57euhKT1G8=.sha256" > blob.jpg
# before=blobs locl=null
# blobs.get="&JlJHc9yeG1EpZA9fIPGLzUKDH0FeR39Ai57euhKT1G8=.sha256" written=37939
Latest working commands, using [sbotcli-getsubset](https://github.com/cryptoscope/ssb/pull/128) branch: ```shell ./sbotcli blobs add ~/Pictures/chiku.jpg # before=blobs locl=null # blobs.add="&JlJHc9yeG1EpZA9fIPGLzUKDH0FeR39Ai57euhKT1G8=.sha256" ./sbotcli publish about --image "&JlJHc9yeG1EpZA9fIPGLzUKDH0FeR39Ai57euhKT1G8=.sha256" "@Sih4JGgs5oQPXehRyHS5qrYbx/0hQVUqChojX0LNtcQ=.ed25519" # level=info client=connected method="unix sock" # event=published type=about ref="%6J74ZUhsz+avbXn/vAOL5tnj/LnuwFDmr5hgQDTYYMk=.sha256" # %6J74ZUhsz+avbXn/vAOL5tnj/LnuwFDmr5hgQDTYYMk=.sha256 ./sbotcli blobs has "&JlJHc9yeG1EpZA9fIPGLzUKDH0FeR39Ai57euhKT1G8=.sha256" # before=blobs locl=null # level=info client=connected method="unix sock" # event=blob.has r=true ./sbotcli blobs get "&JlJHc9yeG1EpZA9fIPGLzUKDH0FeR39Ai57euhKT1G8=.sha256" > blob.jpg # before=blobs locl=null # blobs.get="&JlJHc9yeG1EpZA9fIPGLzUKDH0FeR39Ai57euhKT1G8=.sha256" written=37939 ```
Sign in to join this conversation.
No Milestone
No project
No Assignees
2 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: golgi-ssb/golgi#21
No description provided.