Python modules for node, client and self-encryption

Yes, it’s a python module but it has bindings to rust for python 3.8-3.12. You should not need to compile it unless you are on an os that it’s not built for, but if you are, just having rust installed is fine, it would build in the background. No need for the repo installed or anything like that.

Let me know the OS . python version and if there are any issues after you have rust installed.

BTW @riddim have you tried out uv? It’s pretty amazing and blinding fast. GitHub - astral-sh/uv: An extremely fast Python package and project manager, written in Rust.

Oh on looking it could be the binding failed there @riddim I may need to republish, it was a bit of. nightmare to set up, but it won’t be much of a fix if so. Can you try safenode as well for me (just as a test)

for info I just did this

from autonomi_client import Client, Wallet, PaymentOption # All OK 
initial_peers = [
    "/ip4/142.93.37.4/udp/40184/quic-v1/p2p/12D3KooWPC8q7QGZsmuTtCYxZ2s3FPXPZcS8LVKkayXkVFkqDEQB",
    "/ip4/157.245.40.2/udp/33698/quic-v1/p2p/12D3KooWNyNNTGfwGf6fYyvrk4zp5EHxPhNDVNB25ZzEt2NXbCq2",
    "/ip4/157.245.40.2/udp/33991/quic-v1/p2p/12D3KooWHPyZVAHqp2ebzKyxxsYzJYS7sNysfcLg2s1JLtbo6vhC"
]

client = Client.connect(initial_peers)

That seemed to work for me, so let me know

These examples may also help safe_network/autonomi/examples at main · maidsafe/safe_network · GitHub
And for node (ignore the storage options in the below though)
safe_network/sn_node/python/example.py at main · maidsafe/safe_network · GitHub

9 Likes

Thanks for the reminder @happybeing! I’ve put in a PR to expose the inner MerkleReg here: feat(autonomi): expose inner MerkleReg type by b-zee · Pull Request #2426 · maidsafe/safe_network · GitHub

12 Likes

macOS 14.6.1
python 3.11.10

(I actually had rust already installed)

no didn’t so far :open_mouth: I’m on poetry but switching between the python versions (not dependencies) for now is a bit a pain for me … venv sometimes does funny stuff and I don’t understand why … maybe worth a shot to resolve that issue :thinking: (if the dependency lock is as good as with poetry :wink: … will have a look)

that seems to work like expected :slight_smile: no errors (I just ran the test case you linked … obviously test paths/keys/etc but no errors related to the package itself I think)

just for the client it already fails for the imports


oh - and since I was at it anyway:

the self encryption does look good too :slight_smile:
just feeling a bit strange in python to work with objects that come with that few functions and don’t expose internal variables :smiley:
… I’m more used to a multitude of functions and variables where I can dig into the objects and have to search for the function I wanted to use xD …

image

5 Likes

Thanks @riddim I will do another publish of the client today and that should sort that out. There must be an issue in the workflow, but easy fix (just takes some prodding). But I will get another one done today anyway.

10 Likes

then I’ll make sure to load some more attos to my testing wallet (+ some test eth) it in preparation :smiley:

10 Likes

They are building now and hopefully I can stop that rebuild stage you are seeing. Will report back in an hour or so

12 Likes

There you go @riddim Let me know how that goes for you. autonomi-client · PyPI The node will also update but it’s only a version number there and hopefully both now don’t require the build step you seen, but let’s see (GitHub release nightmares :smiley: :D)

7 Likes

image

5 Likes

how do I make it look at Sepolia and not arbitrum one? :open_mouth:

I can probably just set the env variable … but not sure that’s how it’s supposed to be …

but it’s not blowing up into my face on import anymore - guess you found the issue and resolved it :slight_smile: :smiley:
getting gas balance from arbitrum one as well - so something is working; just not interacting with the right chain yet for me :slight_smile:

2 Likes

Just a guess, but this might be the SECRET_KEY environment setting?

2 Likes

hmhmmm - it works with the right key … but I’m getting the wrong balance (well … the right balance on the arbitrum one network…) … and even when setting the EVM_NETWORK environment variable I’m not getting the right result :-/ …

the node comes with the flag for it

(but please note the inconsistency; here it’s an underscore - while everywhere else currently it’s a dash - )

the autonomi client seems to connect to arbitrum one always and I don’t see where I can set a different network

2 Likes

I need to get help from the team on the evm_wallet parts. I am not clear on any of that part at all.

2 Likes

but hey - it looks very promising! - let me check if I can fetch some already uploaded data :thinking:

2 Likes

Were on it, questions asked. Publishing a new client with that functionality should be a breeze now after this mornings fight with GitHub actions :smiley: :smiley:

3 Likes

I’m using peers from the peer-list we use to start nodes :face_with_monocle:

and i tested the code in a regular *.py file too not just a Jupyter notebook; it’s not connected to the kernel of a Jupyter notebook stops until the next command flies in

from autonomi_client import Client, Wallet, PaymentOption

# Connect to network
client = Client.connect(["/ip4/167.71.140.72/udp/37462/quic-v1/p2p/12D3KooWMrQ95QFLzKkyTc2X3aEFqGhH5cPmsf1QkCuAD4PWNqyW",
"/ip4/206.189.16.118/udp/35160/quic-v1/p2p/12D3KooWSRowtypftsvPgEzDYvCk3aFgXuTvrLWz5CuLCyuRGXvF",
"/ip4/167.172.56.106/udp/60814/quic-v1/p2p/12D3KooWPbfY8FpzVYRVy6zCSKVPNG59iq4Ec8JkPpEfzkHDFFMB",
"/ip4/142.93.38.156/udp/60630/quic-v1/p2p/12D3KooWK4knM4w2wL5mdQHuLP8UPiXSKE8ag9mN1d7pyHTMBdME",
"/ip4/142.93.43.103/udp/43996/quic-v1/p2p/12D3KooWAC92dCnzkssVVNgKaCTBWo6hdemvjk3bY17XM2FvMPZC",
"/ip4/142.93.37.4/udp/58709/quic-v1/p2p/12D3KooWPN5fDaCnvTkDbh8HwUESP89RYGWif1R5g4w4VYQguhK2",
"/ip4/157.245.40.2/udp/33698/quic-v1/p2p/12D3KooWNyNNTGfwGf6fYyvrk4zp5EHxPhNDVNB25ZzEt2NXbCq2",
"/ip4/46.101.81.174/udp/59677/quic-v1/p2p/12D3KooWPmYKmwscF3oaaH9QpyLEJWRXWtD2c6MAnHt5GajVpLeE",
"/ip4/206.189.118.154/udp/56975/quic-v1/p2p/12D3KooWDFhb59KopBMko3TPUvG3PCEC151Xa9udwdMkGa49K153",
"/ip4/138.68.156.139/udp/52399/quic-v1/p2p/12D3KooWP2LgVw5ttgyx6VxUjgB3yJx3k8BFXwPdEhFWz3KaxhhP",
"/ip4/138.68.142.88/udp/40172/quic-v1/p2p/12D3KooWQ2BrH8eGcNYuzJ2kGQL7puCPMNZLkUC7Mjy9cHY4gKCa"])

# Download data
retrieved = client.data_get("e731c67a6be8c6abc052ed17338f540ab650e969d5a86571c1cb9821738a7956")

print(retrieved)

3 Likes

Cool, that’s also on the list Can you confirm that data does exist, even so though, there’s a bug in the message channel there.

Can I ask a favour @riddim ? Can you post the commands you use as text so I can copy and paste them easily? Ok so far, just in future. Actually errors to as I can ask cursor to help identify the issues :wink:

FYI you can see the bindings here → safe_network/autonomi/src/python.rs at main · maidsafe/safe_network · GitHub

5 Likes

is Beg Blag and Steel from @aatonnomicc uploads


EDIT:

just checked from cloud machine

autonomi client built with git version: stable / 19921e0 / 2024-11-06
🔗 Connected to the Network                                                                                                            Fetching file: "BegBlag.mp3"...
Successfully downloaded data at: e731c67a6be8c6abc052ed17338f540ab650e969d5a86571c1cb9821738a7956
4 Likes

Ah, in our api we have EvmNetwork::ArbitrumOne, // TODO: Make this configurable which is coming from rust. So we will get that an update the python bindings

5 Likes

Ah it seems there is a bit of an issue. It’s an API issue as the current mechanism is to pass env vars at compile time. So this means binary distributions of our code or in bindings like this will be stuck at whatever the vars are set at which is a bit of a bad thing. We will get this sorted though.

This is already great news as it gets the API sorted out and sorted in a sensible way for devs. I know many have wanted this and hopefully this push now will get these niggles sorted out fast. They are not big code things, just tidy up things and we cna get that done quickly I would hope.

12 Likes

I might need a week here, hopefully less. In that time @happybeing I might ping updates to a PR so you can check register use as you have tried that.

I intend to do a fairly extensive refactor of the API, not really changing what the code does, just how we allow folks to use it.

13 Likes