Introducing NEAR Document Cloud — A Decentralization Approach to Manage Documents | by Piotr Rotyński | Apr, 2022

The Web3 approach of managing paperwork

The sturdy and trustless answer to signal, handle, retailer, and modify paperwork.

The whole lot is powered by the next-generation layer-one blockchain NEAR platform.

NEAR shouldn’t be the most well-liked blockchain on the time of writing but it surely has an excellent basis to be chosen for a decentralized utility that’s not less than theoretically a mass consumer-focused app.

It must be low cost and quick, it must be scalable and permit customers to simply enter it with out having any prior setup and it additionally mustn’t affect the atmosphere. In comparison with Ethereum, NEAR has it and make it useful for such use case.

All of us signal or not less than acknowledge paperwork or agreements with varied events. These might be banks, actual property brokers, and landlords. The identical is true for firms that do endeavors formalized by the use of agreements with customers and different companies

A single settlement that bounds two events can have a number of revisions issued and thus administration (i.e storing, signing, issuing) of this all is advanced.

There are an increasing number of such options to cut back the friction of doc administration however on the time of writing, none of those relies on web3. That’s the reason NEAR Doc Cloud is yet one more answer to this drawback however this time there’s decentralization concerned.

The UI layer is at present on the wireframing stage. Typically, my private opinion is that any UI is infinitely higher than no UI even for technique of communication amongst technical guys. It robotically makes everybody on the identical web page and clearly understands the thought.

Let’s focus on the NEAR doc cloud’s most essential frames and deal with it as the very best clarification of the entire challenge’s goal

Itemizing agreements

Right here we present all agreements both issued by or issued for the logged-in consumer. This can be a sort of a welcome web page the place the consumer can instantly see any actions to be carried out i.e signal a newly issued settlement earlier than some due date.

Itemizing of all paperwork

On the agreements checklist we can also see a transparent distinction between agreements issued by me and people issued for me (the place I’m alleged to signal)

Issuing new settlement

Visualization of including a brand new settlement course of with a quite simple kind

Any consumer can add an settlement. Including settlement requires enter not less than ipfs hyperlink to the preliminary doc model and supposed signer. All remaining particulars are a matter of potential extension and choice on the place to retailer these (on-chain vs off-chain).

Signing agreements

Customers can signal the settlement provided that it has been issued with specific indication he/she is the supposed signer. Attempting to signal an settlement that has not been issued for performing consumer will throw (reject tx).

An settlement with a bank card operator that isn’t but signed

Within the picture above we will see the Settlement with the credit score cart operator not signed as a result of it has been up to date – the issuer has added revision two and to formally be in pressure this settlement must be signed once more. This may be simply achieved by clicking the signal with the pockets button and acknowledging the tx.

Including new revision

Consumer can solely add revision for these agreements he/she has issued. Attempting so as to add a revision to an settlement issued by another person will end in transaction rejection.

Including new revisions may probably be achieved on a separate display screen and require simply getting into ipfs hyperlink to a brand new doc. All different particulars of the settlement like earlier hyperlinks, signing historical past, or different particulars must be read-only at this stage.

Including a brand new revision units the entire settlement in isSigned : false the state, irrespective of if it has been already signed or not. Situations have modified and the settlement cannot be robotically in pressure/signed with out the signer explicitly signing it once more.

Settlement contract

Settlement class ought to have:

  • issuer for storing the issuer pockets deal with
  • isSigned for monitoring the settlement’s newest revision signed state
  • variations for retaining monitor of all variations of the settlement

Moreover, it has two strategies one when the settlement is signed and one when a brand new revision is added.

The Settlement class with its constructor & manufacturing facility perform that provides new settlement to the cloud

Let’s break it down and focus on the code in chunks.

constructor(public uri: string, public signer: string) 
this.issuer = Context.sender;
this.isSigned = false;
this.variations = new PersistentVector<string>(`$uri-v`);
this.uri = uri;

Within the constructor, we see that every settlement has its signer set to methodology callee, it’s initially not signed, it has added the primary model to its variations assortment (by the use of PersistenVector), and its uri is preliminary URI, occasion if the present URI will change afterward.

addAgreementVersion(model: string): void
assert(Context.sender == this.issuer, "Solely issuer can replace
this.isSigned = false;

addAgreementVersion simply ensures that the callee is the preliminary issuer and resets isSigned flag to false (as after including a brand new revision the entire settlement must be signed once more since apparently, the situations have modified) and provides the brand new model to thevariationsassortment

signAgreement(): void
assert(Context.sender == this.signer, "You are not allowed to signal this");
this.isSigned = true;

signAgreement ensures the callee is the one indicated because the signer and if that’s the case it modifications the flag isSigned to true.

The settlement contract utilization

These features right here simulate a sort of a manufacturing facility class ensuring there’s a register with all agreements and name features of every class to current how issues work down on the class degree.

More Posts