Code Monkey home page Code Monkey logo

Comments (7)

bmavity avatar bmavity commented on June 4, 2024

What is the error message?

Most likely you are trying to ask the light-wallet server to do Proof of Work, but the server does not allow it. As of right now, the only way to complete the tutorial is to run your own full node.

Eventually there will be a sandbox you can use or the tutorials can be updated to do proof of work locally. (I do not know how to do this offhand, but the wallet does it so I know there's a way)

from iota.js.

crypto5000 avatar crypto5000 commented on June 4, 2024

Thanks @bmavity for the reply and help! It's just a standard error message: "Failed to load resource: the server responded with a status of 401 (Unauthorized)" in the console. I thought this may just have been a basic auth issue where I needed to send a user/pass with the data request. I had assumed there should be a way precisely because the web wallet seemed to be doing proof of work locally, but after looking at @danilind's repo, it doesn't seem as straightforward as I first thought. I think the web wallet may be using a full node as you suggest. There's a dedicated ip for one of the providers.

It seems then I'm going to take a 2-prong approach:

  1. First, build a manual proof of concept for my project, running the transfers through the desktop wallet. This isn't scalable, but will show the use case.
  2. Try to see if I can port some of the web wallet code with a full node to replace the manual approach.

Thanks again for the reply!

from iota.js.

danilind avatar danilind commented on June 4, 2024

The web wallet does the pow locallyusing the pow lib for javascript. If you have any questions about how it's done in the web wallet, feel free to contact me in slack (@danili)

from iota.js.

crypto5000 avatar crypto5000 commented on June 4, 2024

Hi Daniel! Thanks for the offer to help and thanks for building the web wallet. It's awesome.

2 quick questions for you regarding the web wallet:

  1. Are you running a full node to process the transactions or are you doing the PoW locally and then connecting to a Light Wallet Server remotely to process the transactions? In other words, a full node vs remote node approach.
  2. Can you explain the sendTrytesWrapper function in iota.wrapper.js? This seems like a modification of the sendTransfer function in iota.lib.js. What's the purpose of the commented out ajax call to localhost (http://127.0.0.1:500)?

Perhaps I can explain what I'm trying to do and you can offer some advice, since I think the web wallet contains all the functionality for what I'm trying to build.

I'm trying to build a voting/survey/poll system with IOTA as the data layer. There can be many different types of polls (simple, reverse, uncapped, authenticated, etc), but for the basic case, consider the simple poll. A simple poll would have a cap of say 100 votes and a choice of say 2 options. The cap is represented by a starting balance of 100 iota in a wallet. With a simple poll, a "user" should not have to own or purchase IOTA (through bitfinex, etc). They should just come to a site, and drag a single iota-like coin into a ballet box (say the vote is whether they like the web wallet or the desktop wallet better). Once the user clicks or drags their vote into the box (say they vote for the web wallet), then an iota is sent from the starting wallet to a new wallet used to store the current results. The balance decreases to 99 for the remaining votes, and the address associated with the "web wallet ballet" now has a balance of 1.

The 2 technical elements that seem pertinent are securing the seed (because the user is just indicating a determined action between wallets) and actually sending the transaction between wallets. Ideally, I envisioned the scenario where the proof of work is done locally and the transaction is sent through a light-wallet server using the sendTransfer function in iota.lib.js.

Any help, guidance, or suggestions are welcome and appreciated!

from iota.js.

danilind avatar danilind commented on June 4, 2024
  1. It does the pow locally, and uses a light node for the other operations.
  2. Yeah, thats exactly right. Because I'm doing pow locally, I cannot use sendTransfer, so I have to reimplement it (though most of it, except attachToTangle, is just copied). The commented out code is to make the pow on a server. It's part of a trial to outsource the pow to a remote device, as the current implementation of local pow is a bit limiting. The server will be running separate from the actual iota node, and it's supposed to be a hybrid solution between the existing one and remote pow. Basically the server and local browser both start the pow, and "race" to solve it. In this scenario the server may reject the query if it's busy, so the local pow is just complemented, not replaced.

In this case I believe the wrapper around sendTransfer I made i iota.wrapper.js is what you're looking for. You also need the curl package (https://github.com/iotaledger/curl.lib.js) to do the acutal pow. Note that the version I'm using had a slightly different output then the new version. I believe it now returns the trits instead of trytes, but you might want to talk to paul h about that.

You should keep in mind that it may detriment the user experience when the pow is done locally, as it does take a bit of time. This may especially be the case in such an application where the user except the voting to be a fluid action without waiting.

I'm also working on utilizing web workers to provide a better user experience (and hopefully a speed up), and I can keep you updated on that if you are interested.

from iota.js.

crypto5000 avatar crypto5000 commented on June 4, 2024

Thanks so much, Daniel. This is amazingly helpful stuff. I really appreciate it.

I'm going to follow your advice and use the wrapper approach. It seems that approach (in my opinion) is probably a lower bar for developers to just get started building web-like IOTA applications - rather than having to run a full node and manually tether. I'll definitely keep watch of your github repo to see how the code progresses and to see how the web workers improve the experience.

All the best, thanks again!

from iota.js.

crypto5000 avatar crypto5000 commented on June 4, 2024

This approach appears to work with no problems.

from iota.js.

Related Issues (20)

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.