Document Store – 文档存储区块链毕设代写

区块链毕设代写本文提供国外最新区块链项目源码下载,包括solidity,eth,fabric等blockchain区块链,Document Store – 文档存储区块链毕设代写 是一篇很好的国外资料

Document Store

This repository contains both the smart contract code for document store (in /contracts) as well as the node package for using this library (in /src).

Installing Package

npm i @govtechsg/document-store

Package Usage

To use the package, you will need to provide your own Web3 provider or signer (if you are writing to the blockchain).

Deploying new document store

import {deployAndWait} from "@govtechsg/document-store";  const documentStore = await deployAndWait("My Document Store", signer).then(console.log);

Connecting to existing document store on Ethereum

import {connect} from "@govtechsg/document-store";  const documentStore = await connect("0x4077534e82c97be03a07fb10f5c853d2bc7161fb", providerOrSigner);

Deploying new document store with minimal proxy (TBD – Not available yet)

import {deployMinimal} from "@govtechsg/document-store";  deployMinimal("My Document Store", signer).then(console.log);

Interacting with the document store (example)

const issueMerkleRoot = async () => {   const documentStore = connect("0x4077534e82c97be03a07fb10f5c853d2bc7161fb", signer);    const tx = await documentStore.issue("0x7fe0b58ed760804eb7118988637693c4351613be327b56527e55bcd0a8d170d7");   const receipt = await tx.wait();   console.log(receipt);    const isIssued = await instance.isIssued("0x7fe0b58ed760804eb7118988637693c4351613be327b56527e55bcd0a8d170d7");   console.log(isIssued); };

List of available functions on contract

documentIssued documentRevoked isOwner name owner renounceOwnership transferOwnership version initialize issue bulkIssue getIssuedBlock isIssued isIssuedBefore revoke bulkRevoke isRevoked isRevokedBefore 

Provider & Signer

Different ways to get provider or signer:

import {Wallet, providers, getDefaultProvider} from "ethers";  // Providers const mainnetProvider = getDefaultProvider(); const ropstenProvider = getDefaultProvider("ropsten"); const metamaskProvider = new providers.Web3Provider(web3.currentProvider); // Will change network automatically  // Signer const signerFromPrivateKey = new Wallet("YOUR-PRIVATE-KEY-HERE", provider); const signerFromEncryptedJson = Wallet.fromEncryptedJson(json, password); signerFromEncryptedJson.connect(provider); const signerFromMnemonic = Wallet.fromMnemonic("MNEMONIC-HERE"); signerFromMnemonic.connect(provider);

Setup

npm install npm lint npm test npm truffle <command>

Contract Benchmark

A benchmark is provided to show the different transaction cost of the different variants of the document store.

npm run benchmark

Document Store - 文档存储

Notes

If you are using vscode, you may need to link the openzeppelin libraries. See https://github.com/juanfranblanco/vscode-solidity#openzeppelin

We use optional third-party analytics cookies to understand how you use GitHub.com so we can build better products. Learn more.

feat: abstract common contracts and clean up (


Document Store

此存储库包含文档存储的智能合约代码(在/contracts中)以及用于使用此库的节点包(in/src)。

Installing Package

npm i @govtechsg/document-store

Package Usage

要使用该软件包,您需要提供自己的Web3提供商或签名者(如果您正在向区块链blockchain写入数据)。

部署新文档存储

import {deployAndWait} from "@govtechsg/document-store";  const documentStore = await deployAndWait("My Document Store", signer).then(console.log);

连接到以太坊eth上的现有文档存储

import {connect} from "@govtechsg/document-store";  const documentStore = await connect("0x4077534e82c97be03a07fb10f5c853d2bc7161fb", providerOrSigner);

使用最小代理部署新文档存储(TBD-尚未提供)

import {deployMinimal} from "@govtechsg/document-store";  deployMinimal("My Document Store", signer).then(console.log);

与文档存储交互(示例)

const issueMerkleRoot = async () => {   const documentStore = connect("0x4077534e82c97be03a07fb10f5c853d2bc7161fb", signer);    const tx = await documentStore.issue("0x7fe0b58ed760804eb7118988637693c4351613be327b56527e55bcd0a8d170d7");   const receipt = await tx.wait();   console.log(receipt);    const isIssued = await instance.isIssued("0x7fe0b58ed760804eb7118988637693c4351613be327b56527e55bcd0a8d170d7");   console.log(isIssued); };

合同上可用功能的列表

documentIssued documentRevoked isOwner name owner renounceOwnership transferOwnership version initialize issue bulkIssue getIssuedBlock isIssued isIssuedBefore revoke bulkRevoke isRevoked isRevokedBefore 

Provider & Signer

获取提供者或签名者的不同方法:

import {Wallet, providers, getDefaultProvider} from "ethers";  // Providers const mainnetProvider = getDefaultProvider(); const ropstenProvider = getDefaultProvider("ropsten"); const metamaskProvider = new providers.Web3Provider(web3.currentProvider); // Will change network automatically  // Signer const signerFromPrivateKey = new Wallet("YOUR-PRIVATE-KEY-HERE", provider); const signerFromEncryptedJson = Wallet.fromEncryptedJson(json, password); signerFromEncryptedJson.connect(provider); const signerFromMnemonic = Wallet.fromMnemonic("MNEMONIC-HERE"); signerFromMnemonic.connect(provider);

Setup

npm install npm lint npm test npm truffle <command>

Contract Benchmark

提供了一个基准来显示文档存储的不同变体的不同事务成本。

npm run benchmark

Document Store - 文档存储

Notes

<Document Store>

如果您使用的是vscode,则可能需要链接openzeppelin库。看到了吗https://github.com/juanfranblanco/vscode solidityopenzeppelin

feat: abstract common contracts and clean up (

部分转自网络,侵权联系删除区块链源码网

www.interchains.cc

https://www.interchains.cc/19070.html

区块链毕设网(www.interchains.cc)全网最靠谱的原创区块链毕设代做网站 部分资料来自网络,侵权联系删除! 最全最大的区块链源码站 ! QQ3039046426
区块链知识分享网, 以太坊dapp资源网, 区块链教程, fabric教程下载, 区块链书籍下载, 区块链资料下载, 区块链视频教程下载, 区块链基础教程, 区块链入门教程, 区块链资源 » Document Store – 文档存储区块链毕设代写

提供最优质的资源集合

立即查看 了解详情