Crypto/contracts/dapps etc

Hi guys. I’m getting frustrated and i need some advice. I’m trying to build a monetary system that works for the people. I’ve already built a prototype (browser extension) but i want to move forward. Ethereum is the obvious choice, but it still sucks. It’s full of bugs, the docs are out-dated, and it already takes a loooong time for the wallet to download all of the transactions. Sure, users can download a ‘light’ version, but that kinda defeats the object.

Now, i’m still trying to get my head around Maidsafe. What’s the deal with smart contracts? If a contract was made that involved two parties, and it was cryptographically signed by both parties, then you wouldn’t be able to change the contents, as it wouldn’t match the contents that were signed for. And both parties would have a copy of the contract. Is that not enough? Does anyone have any suggestions about this?

My second question is, how feasible would it be to use a browser extension with maidsafe? Will the api allow me to read and write data to a db stored on the safe network? Is this something i can play around with now?

I’ve mentioned this before, but i think my app could be very useful to the safe network as it’s a content voting/crediting system that uses public profiles for establishing trust etc. It would make a very efficient search engine. Attached is a screenshot. There are other tabs where you can register/login, create keys, send credits etc

1 Like

@Glen_Simister

My second question is, how feasible would it be to use a browser extension with maidsafe? Will the api allow me to read and write data to a db stored on the safe network? Is this something i can play around with now?

You no longer need a browser extension - users just need to set up a proxy, and then the same browser works with clear web and, if the SAFE Launcher is running, with SAFEnetwork.

This means that you can use JavaScript in the browser to build a web App with access the SAFE Launcher API. This already gives access to a subset of the SAFE API (stored files/NFS & DNS) and will be extended to include Structured Data and immutable data, and I expect most or all of the API wherever practicable.

I got an in browser web App talking to SAFE Launcher for the first time only last night, and there are at least three others here who I know have done so too and shared code and examples.

@eblanshey has provided a simple JavaScript API for people to use to build in-browser apps (search for safenet.js). Or you can adapt the MaidSafe example code from the documentation, as I did (but beware that is node.js code rather that browser ready).

There are security considerations with apps run in a standard browser - if you inserted clear web links into your app for example - but as the application author you can and should avoid this, and users can trust code that is loaded entirely from SAFEnetwork if you store it all as immutable data. Some guidelines on security will be needed I think - I probably don’t understand all the issues, and @cretz has been critical of even allowing this. So for a security conscious application I think you should discuss and investigate further, and really we should all be writing security conscious applications these days!

Smart contracts are planned but don’t exist yet, so I think you’re going to have to wait a few months for that, but it’s impossible to predict timescales. Things could take longer than we want, or could start moving quicker than we expect once the network core is stable.

Hope that helps a bit - it would be great to have you developing this for SAFEnetwork and I’m sure you’ll find others who will support the idea here.

4 Likes

Ethereum’s blockchain, as compared to what you’re describing, has an independent existence from any participant on their network, and the records can’t be erased or lost. That allows a contract to execute independently of any client computer; the execution is built-in to the ongoing mining operations.

The main problem I foresee with a contract only being kept by two parties is how to enforce it in the event of a dispute.

Maidsafe’s mining (farming) serves to incentivize the providing of disk storage, and I don’t know if its in the pipeline to add to that, for example when a compute layer is introduced, which would be the “world computer” that Ethereum is described as being. With such a compute layer then you could have contracts permanently recorded and executing in the cloud, independent of the users who created them.

Until that happens, notary services would serve the purpose of keeping copies of the contracts and arbitrating disputes.

ADDENDUM: Ethereum’s blockchain allows for an Internet of Things, with machines carrying on economic activity autonomously. That’s not as sinister as it might sound: it would be very convenient to tell ones machine servants to do the shopping, pay the bills, and metaphorically “keep the lights on” without constant, low-level supervision.

2 Likes

Thanks for the info guys. @happybeing

I can still use a browser extension though right? I was considering adapting a browser such as Min. It’s open source and built using electron (html/css/js) but i had some compilation issues with it. Anyway, providing i have the launcher installed, i can write to the network from my extension via a proxy using the SAFE Launcher API right? You said you got an in browser web app talking to the SAFE launcher last night. I’d love to give this a go. But apart from the whitepaper i haven’t seen much in the way of docs. I tried looking at systemdocs.maidsafe.net but the page wouldn’t load. Is there a particular resource i should know about? I’ll give safenet.js a try once i’ve got the launcher working. When creating an account i get… “Waiting for establishing connection…”. I’ll give it another try later.

Regarding the security stuff, well, i’m still a newb. However, my extension does currently utilize public key cryptography, including a very hacky ‘proof-of-work’ type system whereby all operations such as registering, sending and verifying transactions need to be signed, and the signature must match a specified criteria. I don’t think doing that in js is the way to go though lol.

@bluebird - Ok i see. So yeh you could setup a timestamp + multi-sig type scenario, but the issue is that they won’t self-execute independently. So some sort of cloud-based escrow feature is required. Well, as long as they’re planning on implementing something in the future…I’m good :wink:

@Glen_Simister Originally the idea was you would need a browser extension in order to access SAFE Network from a browser, so I was saying you don’t have to use a browser extension but yes of course you can if that’s what you want.

My code is not worth sharing at this point but if you want to see it I’ll push it to my repos. All I did so far is send an auth request to the Launcher and receive an “Unauthorized” response - it is just the MaidSafe docs /auth example code but adapted from node.js to pure JavaScript. I posted a summary of what I did on the remoteStorage forum.

Let me know if I can help. I don’t have much time and even less knowledge (really I don’t - I’m new to the whole JavaScript ecosystem) but will if I can.

EDIT: Ok, I pushed the code that I referred to and you can view it here. I recommend viewing only while wearing sunglasses :wink: Very little else in that file is real or working, just a copy of a totally different backend for Dropbox.

ok thanks. If i get launcher up and running ill give it a go. BTW, i’m pretty new to this stuff also. This is the first proper app i’ve worked on and it’s been a real headache so far. I’ve been to ‘callback hell’ and back lol

1 Like

I see you have updated the launcher since yesterday (now 0.4.4) . I’m now able to create an account. whoohoo! :slight_smile:

1 Like