Checkout ethereum package management and Populus, Solgraph
- Solgraph visualizes how your contracts are interacting with other contracts
- Solium is a linter for solidity
Eclipse is a horrible IDE, waste of time to support solidity on
Biggest problem with solidity is that it's a young language which means there are a lot of features that programmers aren't sued to. Basic primitives and things that make it easy to start out, but there aren't any advanced tools, and safety concerns
ZoKrates is super exciting, gets cryptographic primitives into solidity which enables solidity to support zero knowledge proofs.
Decentralized data marketplace that is aprt onchain, part offchain. Launched from Enigma - a decentralized computation platform that can guarantee correctness
- Catalyst is the first dApp on the Enigma network
Data marketplace
- providers
- Offchain registration of data set
- Upload or store on own nodes (AWS)? and provides an address / metadata to the chain
- Reference to the chain offchain is onchain
- Consumers
- Can come in an request the data by browsing onchain
- provides a deposit
- off-chain worker nodes
- No stake in data consumption but do all the work
Incentivizations
Create a measure of value for data
Storage and computational work is rewarded through fees System is eared towards contributing good data, does this by associations the rank of a dataaet with the stake put on it
(STRENGTH OF THE DATA SET IS RANKED BY THE AMOUNT OF MONEY THAT HAS BEEN DEPOSITED)
Offchain
- Normal consensus is expensive and not scalable, need to figure out a way to segment the network
- Different computations and different types of storage should only concern a section of the network
- Main idea: shard data into logical segments, Use quoroms to store data and run subsequent computations over it
LOOK INTO DFINITY (THRESHOLD SIGNATURES)
Once we have a node/quorum storing some data, we can let them run queries on it. But how do we ensure that queries are run correctly without revealing the underlying data if that data is sensitive
Solutions: outsource private computation -- Focusing on sMPC and secure hardware
Secure hardware requires some trust in the provider, MPC allows trust-less verification
MPC (Multi Party Computation)
-
imagine there is an ideal world, where there is a godlike machine and we can outsource any sort of computation to it and trust it completely. In the real world, let's simulate that with a network. As long as there is one node that is not a bad actor, you can ensure that computation is correct.
-
Split a data request into encrypted shares and distributed to nodes. Consumers can come in and run computations against all nodes, each node can run the computation and then respond the aggregate result of the nodes.
-
Multiplication requires communication between nodes, addition can be performed locally by each node.
- Use a one time pad to communicate operations with other nodes.
-
With addition and multiplication, you can securely store/compute any circuit -> We can construct a secure VM
Catalyst
in order to bootstrap a data marketplace, let's look at some usecases. Catalyst is a platform for sharing and consuming crypto data for developing trading strategies.
Evoting: end to end verifiable system.
Achieving E2E requires authenticated public channel with append-only bulletin board
Blockchain provides the desirable consistency property - full nodes can verify its contents without trusting a third party
CANNOT LINK A PERSON'S REAL WORLD IDENTITY WITH HOW THEY VOTED
Smart Contract that preserves voter privacy
Self-tallying elections
- Perfect Ballot Secrecy
- After election, anyone can count the votes
- Dispute-free
However, this is not end to end verifiable. Which requires the voting machine is trustworthy. Machine can be assumed to be trustworthy.
Black chains scale better if they only verify, and not compute a zero knowledge proof. Or computations in general
In blockchains, everything is public, and zkSNARKs allows zero knowledge of the transaction that occurs
Zero Knowledge
Aspect of interactive protocols. 2 parties: prover and verifier.
Prover wants to convince the verifier of a certain fact without revealing why it is true
- given message is valid transaction
- there is some w such that f(x, w) = y for ficed f
- mini sudoku board
Mini-sudoku
Prover wants to convince the verifier that the sudoku board is solvable without revealing the solution
- Shuffle solution numbers (simple 1-1 encoding)
- Prover write the shuffled solution and covers everything (obfuscates)
- Verifier chooses them to reveal certain aspects of the board (initially filled cells, rows, columns, subsquares)
- Prover reveals as requested
- Verifier checks the revealed shuffled cells against the initially filled cells
Repeated n times, prover needs to pick a new shuffling(encoding) for each round
No private information was revealed because the replacements are completely random with equal probability
Verifier doesn't check everything, the more rounds you have, the lower the chance of cheating, however requires many rounds of interactions
Works because the prover write a commitment to the actual solution
xkSNARKs Based on polynomial theorem: two different polynomials of degree up to n can coincide in at most n points -> n is tiny compared to the number of possible evaluation points
- Map computation to polynomialequations: prover knows a (secret) w such that for all x: a(x) * w(x) = b(x) * c(x)
- w is secret solution
- Verifier chooses secret evaluation point
- Asks prover to evaluate the polynomials using homomorphic encryption
- Verifier can check validity
Homomorphic Ecnryption Allows computation on encrypted data. Does not work for arbitrary computation but "pairings" can do arbitrary sums with single multiplication at the end
-> which allows hte prover to evaluate the polynomial and an unknown or encrypted point to verify the solution
Trusted Setup Randomly Generate Xm ecryot it to [x] and send [x] to prover, evaluate polynomial and check equality
Equality can also be checked on the encrypted form, don't need the decrypted version anymore! damn
Generate [x] in a distributed process (simplified [x] = [a] + [b] .. (= [a + b ..]))
Summary
- Trusted setup generates reusable [x]
- Prover computes aw and bc of [x]
- Verifier checks equality
- ZK adds a random encrypted number to both sides
SNARKS allows this speed up of computation (achieving zk)
Make sure to analyze roles in your smart contract
- Who is interacting with the system?
- What are their Incentives?
- How are their behaviours going to derive from the functions you expose in your contract
Look into the SALTloan contract
Make sure that you're building for context dependence, think about your context. Remember: "it depends".
Contracts are immutable, which means technical debt is a lot costlier.
Represents 5% of the transactions on Ethereum
Look into State of the DAPPs
Metamascara finds the environmental provider and extracts it for you, if none available will connect othe new metamask webapp wallet.metamask.io
Look into eth_signTypedData
Mustekala to bridge ethereum and ipfs
Look into gitcoin and gittoken
Checkotu pathwork on SSB and beaker browser
Javascript API that allows you to interact with the EVM v1.0 coming which has huge refactors
-
Ehtereum nodes and EVM only understands bytecode, so we need a translator.
-
Web3.js encodes bytecode and uses JSON RPC to talk to the chain.
v1.0
- 1.0 breaks down components into different packages, instead of all bundled into head web3
- Now supports promises! DAMN NIGGA, also implements
PromiEvents
- Allows a more detailed response from sending transactions (on
transactionHash, receipt, confirmation, error
)
- Allows a more detailed response from sending transactions (on
- Supports subscriptions to IPC sockets and WebSocket
- Allows us to wait for events to first instead of continuously polling for events
- However, events can change (on
data, changed
)
- Supports Contracts more explicitly (
web3.eth.Contract)
)- Addresses are all checksumed addresses (upper case means checksummed, lower case not, keep this in mind..)
- Can get function instances back from the contract to change arguments, estimate gas, call, or send
- Same applies to Events, can apply filters and block
- Accounts namespace now allows you to generate accounts, sign, encrypt, decrypt...a ton of features
- ABI encoder and decoder function is now available, exposes a lot of internal web3 stuff to the user
- Supports a swarm API
bzz
- Can upload/download
- Supports whisper API
shh
- Utils namespace is dope (internally everything uses bignumber)
soliditySha3
allows you to hash exactly the same way solidity hashes
- Now available on npm
npm install web3
, checkout web3js.readthedocs.io/en/1.0
Uses prime fiel elements (uint < huge prime)
- Provide usable and tooking for zkSNARKs
- DOmain specific high level language
- Compiler to transform programs to constraint systems
- Setup, witness computation, proof generation, smart contract verification
- Compiles
- Glattens, compute witness
- Setup provides procing key and verification key
- Generate proof (proving key) with witness -> program result
- Verification key, exported toverification smart contract
Sudoku specification
Validity Conditions: values in {1 ... 4} Unique values in rows, columns, subsquares
Write this in code to check entries are valid
Provide account management and authentication, onboarding users without gas, KYC, transaction history, reputation
- Stores all your app accounts in one palce
- Mobile factor authentication and signatures
- Storage of credentials, cerifications, and badges
- Creation of a user profile
Uport account represented using a single identity contract and a control+recovery contract
Working on multi-chain account support across multiple networks
Badges
Build out an API that allows apps to issue badges to users for certain accomplishments.
Built a KYC badge that can be used for token launches
Look into Digital Passport for Crypto Valley
Three entities: dApp, Oracle, Data sources
A complete vendor-agnostic solution to authenticate processes without relying on central points of failure
- Acts as a data-carrier connecting two contexts i na standard and reliable way
- Provides cryptographic gurantees protecting the consumer of the data
Trust Model
Needs to choose a technology to use, there are several protocols out there
- What matters the most is the attestation: the authenticated claim of an attestator which moves the trust away from hte operator to the sttestator
Oraclize aims to be an independant party to service providers that verifies the service - to bundle all of them into a box which offer multiple layers of protection
They are working on delegating the management of the oraclize machine to any one who is interested in keeping the service running
Virtualized off-chain execution - ethereum-based decentralized cloud computing
- Global marketplace for cloud resources
- Providers can interact i na p2p way
- Cheaper and greener and more efficient than traditional centralized cloud
- Blockchain-based DAPPs
- want to offer off-chain computation (servers, data-sets)
- Legacy applications
- Want high performance computing , big data to move from the centralized cloud onto a decentralized cloud
- Emerging distributed applications
- IoT + big data etc.
RLC Token
Pure utility token is the only way to access the decentralized cloud, and the way providers are paid
- was issued on the main net in April
- Currently have a SDK that allows DApps to access the distribued cloud
- v2 features to establish a full market network for applications and servers
- SDK is similar to Truffle
v1.0 The Wanderer
iExec SDK : Smart contract API, CLI, explorer for on-chain / off-chain computation
- Allows you to deploy DApp on ethereum and iExec
- Should check out the tutorial online
- Can run any sort of applciation
- iExec offers contract compilation and deployment to Ethereum and iExec
Deployment
Mainnet deployment soon, want to dpeloy an Appstore on the testnet, and again on the mainnet in december
v2
- Inclusion of any computing resource to join the network
- Proof of contribution
- Ensure safe execution
- Experimental methodology to understand the distributed performance of Blockchain-based distributed systems
- Emulator for large-scale distributed systems (working with LORIA)
Proof of Contribution
- Confidence threshold is associated with each requested execution
- Workers have reputation, gained according to their past succeeded work
- Before workingm, commit a security deposit (stake)
- Confidence threshold is calculated by comparing results and computing of the credibility of the stake
- Task is duplicated as long as the confidence threshold is not met
- Faults lose their stake
- Successes gain payments + loser's stake
Need to sandbox to protect the worker from the application
Enclave to protect the application from the worker (look into Intel SGX SCONE allows you to run SGX in linux container)
December iExec Dapp Development Challenge in December
Key is cross-chain protocol to connect public chains, and private consortium/lan chains. Wanchain handles privacy of sensitive data.
Transactions
Atomic swap of Ether and BTC - Atomocize the transaction by depositing a currency and receiving a token
- Send ether to Wanchain (use wanchain wallet that supports multiple coins)
- Creates a transaction of Ether to Wan, gets locked
- Once validated, 10 ether' is created on wanchain
- ether' is returned for the ether deposited
- Either yourself or your counterparty wants to withdraw the ether, deposit the ether' and gets locked
- Validator that control's locked ether can validate and then unlock the ether and send that back
3 types of validators on the network
- Voucher: validates the transaction on the external network/chain
- Validator: gets notification from voucher and records in Wanchain
- Storeman: store of key share
Economic Incentive uses a security deposit. Violate rules and lose your deposit
Locked Account Address
With n parties (nodes), generate private key-shares (dynamically?)
Each validator uses the key-share and the message to create a sig-share which is aggregated into the signature
One Time Account
Faster than zkSNARKs and easier to setup, with dynamic difficulty (user-chosen) that is correlated to price. Look into Monero.
- This is basically Monero on top of Ethereum
- There is a open beta test, CLI
Think of this like buying a stamp that you can put on an envelope that does not have a from address.
Ring Signature
Use OTA and Ring Signature provides privacy for transaction (??? didn't explain)