I can’t debug this because there are too many things you don’t show that could be wrong.
Before you start trying with your own code I suggest you run through the examples and if they work, adapt that code.
You can also look at my code for a working app here: GitHub - happybeing/awe: A Website Publisher/Browser for Autonomi (demo) That can be used as a CLI app which shows how to connect and store data to the network which should get you started. Run it with --help to see the subcommands and subcommand --help to see the options for each subcommand. There is some information in the README but this is a demo under development, so don’t expect much support.
I find working code is a good way to learn, which is how I figured out the APIs I’m using: by looking at the code under safe_network`. There are some docs for those crates on docs.rs so look there too.
My code is AGPL so free to re-use if that helps. It may be a bit more complex than is helpful when starting from scratch, which is why I suggest you start with the examples. Can you use them with your local network to upload is a good first step.
Be aware though, you can, well I can, easily destroy your real wallet on the local machine when doing this. So I copy the wallet to a safe place every time I run a local testnet.
Good luck.
BTW this is wrong. I suspect you’re using ChatGPT or similar which is a bad approach IMO. You will just cause yourself pain and delay if you do that because it will create great looking code full of mistakes. To learn you need to figure things out yourself, and look at good working code.
Thank for your suggestion. I am not using ChatGPT, I don’t use ChatGPT for written my programs.
This is my own code and not ChatGPTs. Most of the code in the connect function was derived from the get_new_client in sn_client/src/test_utils.rs in the safe_network repo. Get new client code in sn_client repo.
All I am doing in my code is to wrap that function in my own Autonomi struct.
Glad to hear but your code does look ChatGPT, and my apologies for the insult.
You are hard coding invalid peers which is why I thought ChatGPT. You won’t find that in any examples or my code, so you should do that in the proper way before asking why it can’t connect.
It takes some work to get going - I know - but I’m sure you can do it if you are willing to study the examples and in particular the sn_client API and how it is used in safe (sn_cli) and my own app.
Keep at it until you beat it into submission. It’s hard to do this rather than be spoon fed examples but well worth it IMO. You will also get ahead of others if that matters to you.
Hard coding peers was just a thing for test . All I am trying to achieve quickly get a node running, connect to it and validate how it fits my solution before committing to diving deep. I just needed a quick start guided that should be the focus of your replies rather than how another mans code looks similar to that of GPTs.
@happybeing I appreciate your suggestions but given the fact that you’ve being a long term member of this community I think you should be more useful in create start guides for devs interested in the network to increase adoption of the network. Not all experience devs will have the time to dig in to code just to try out a network.
Thanks for the help you’ve already provided it was helpful but you are an arrogant man. I believe I can be arrogant too and still appreciate your help.
Don’t worry I am going to commit to get this community a simple quick start guide to help devs easily try out the network.
That is brilliant and I’ll help with that if and when I can. Perhaps we are both arrogant IDK. I suggest we focus on helping where we choose and accepting what help is offered.
I suspect we have different ways of working though, so that may mean we each go our own way.
Keep posting questions and let’s see who answers them and how. This isn’t my job, so I pick and choose how to spend my time according to what I enjoy, which includes helping others most of the time.