Wallet framework for DOP smart contracts and private balances on Ethereum and more.
npm install dop-engine-v3Wallet framework for DOP smart contracts and private balances on Ethereum and more.
Read about DOP: www.dop.org
For simple implementations, use DOP Wallet SDK.
npm install dop-engine-v3
yarn add dop-engine-v3
There are many APIs that can be imported via import { } from 'dop-engine-v3' but the most important is DopEngine.
Constructors
- DopEngine.initForWallet() (static method) creates an instance
- DopEngine.initForPOINode() (static method) creates an instance
Others
- DopEngine.setEngineDebugger() (static method)
- dopEngine.loadNetwork() (instance method)
- dopEngine.unload() (instance method)
DOP Wallet
- dopEngine.createWalletFromMnemonic() (instance method)
- dopEngine.loadExistingWallet() (instance method)
View-only DOP Wallet
- dopEngine.createViewOnlyWalletFromShareableViewingKey() (instance method)
- dopEngine.loadExistingViewOnlyWallet() (instance method)
Teardown
- dopEngine.unloadWallet() (instance method)
- dopEngine.deleteWallet() (instance method)
"Scanning" consists of algorithms that fetch smart contract data to (re)build merkletree data structures, while also attempting to decrypt notes on the merkletrees, in order to calculate wallet balances.
- dopEngine.scanContractHistory() (instance method)
- dopEngine.emitScanEventHistoryComplete() (instance method)
- dopEngine.syncDopTransactionsV2() (instance method)
- dopEngine.fullRescanUTXOMerkletreesAndWallets() (instance method)
- dopEngine.fullResetTXIDMerkletreesV2() (instance method)
- dopEngine.resetDopTxidsAfterTxidIndex() (instance method)
Merkletrees
- dopEngine.getUTXOMerkletree() (instance method)
- dopEngine.getTXIDMerkletree() (instance method)
Others
- dopEngine.getLatestDopTxidData() (instance method)
- dopEngine.getCompletedTxidFromNullifiers() (instance method)
- dopEngine.getAllEncryptCommitments() (instance method)
- Mnemonic.generate() (static method)
- Mnemonic.validate() (static method)
- Mnemonic.toSeed() (static method)
- Mnemonic.toEntropy() (static method)
- Mnemonic.fromEntropy() (static method)
- Mnemonic.to0xPrivateKey() (static method)
- Mnemonic.to0xAddress() (static method)
- BlindedCommitment.getForDecrypt() (static method)
- BlindedCommitment.getForEncryptOrTransact() (static method)
- ByteUtils.u8ToBigInt() (static method)
- ByteUtils.hexToBigInt() (static method)
- ByteUtils.nToBytes() (static method)
- ByteUtils.nToHex() (static method)
- ByteUtils.bytesToN() (static method)
- ByteUtils.hexStringToBytes() (static method)
- ByteUtils.randomHex() (static method)
- ByteUtils.hexlify() (static method)
- ByteUtils.arrayify() (static method)
- ByteUtils.formatToByteLength() (static method)
- ByteUtils.hexToBytes() (static method)
- getGlobalTreePosition()
- convertTransactionStructToCommitmentSummary()
- encryptJSONDataWithSharedKey()
- tryDecryptJSONDataWithSharedKey()
- getPublicViewingKey()
- AddressData for encoding 0zk addresses
- SpendingPublicKey
- SpendingKeyPair
- ViewingKeyPair
- MerklerootValidator
- MerkletreeLeaf
- InvalidMerklerootDetails
- MerkletreesMetadata
- POINodeInterface
- Via NVM (recommended)
- Via installer
npm install OR yarn
npm build OR yarn build
npm test-V2 OR yarn test-V2
npm run test-hardhat-V2 OR yarn test-hardhat-V2
Clone the contracts repo
git clone git@github.com:Dop-Privacy/contract.git
Start hardhat node from the contract repo and leave it running
npm run node
In another terminal deploy the contracts to the hardhat node network
npm run deploy
The default test config should work fine here as addresses are deterministic on the hardhat node network. If you are running your own test setup you will need to use the config override file. Copy test/configOverrides.test.ts.example to test/configOverrides.test.ts and enter your own values.
You can run subsequent test runs against the same hardhat node deployment as the testing suite will use snapshots to restore hardhat back to the initial state after each test. If for some reason the testing suite is interrupted before it can restore to snapshot you will need to terminate the hardhat node process, restart it, and run the deploy test script again.
In some situations it will be useful to recompile the contract from scratch. In that case, first run npm run clean and then npm run compile, after which it is safe to re-run the node and deploy script.