GithubHelp home page GithubHelp logo

blockchainsllc / in3-legacy Goto Github PK

View Code? Open in Web Editor NEW
76.0 12.0 19.0 3.26 MB

[Deprecated] Typescript-version of the IN3 client.

Home Page: https://github.com/blockchainsllc/in3

License: Other

TypeScript 99.46% Dockerfile 0.54%
verification incubed ethereum client merkle-proof typescript client-library

in3-legacy's Introduction

Incubed Client

Forks Stars License: AGPL v3

The Incubed client is a

  • Crypto-Economic
  • Non-syncronizing and stateless, but fully verifying
  • Minimal resource consuming

blockchain client (Crypto-Economic Client, Minimal Verification Client, Ultra Light Client).

Most blockchains, such as Ethereum, require a client to connect to their blockchain network. Often, these clients require a lot of storage, a very high bandwidth or constant computation. While this is possible to perform on laptops or desktop systems, mobile devices, mobile app, and even web applications struggle to meet these requirements. Currently the solution of choice is to use a light client or remote client on mobile devices. While this may work for mobile phones, most IoT devices are unable to run light clients. Connecting an IoT device to a remote node enables even low-performance IoT devices to be connected to blockchain. However, by using distinct remote nodes, the advantages of a decentralized network are undermined introducing a single point of failure. Also, it is unsecure because the client is not able to verify the results by itself. The same applies for mobile apps or web pages. The Trustless Incentivized Remote Node Network, in short Incubed, makes it possible to establish a decentralized and secure network of remote nodes and clients which are able to verify and validate the results, enabling trustworthy and fast access to blockchain for a large number of low-performance IoT, mobile devices, and web applications.

in3_image

A more detailed explanation of in3 can be found in the concept on readthedocs.

Platforms

Incubed can be used in different ways

Stack Size Code Base Use Case
TS/ JavaScript 2.7MB https://github.com/slockit/in3 WebApplication (decentralized RPC-Client in the Browser) or Mobile Applications
TS/ JS with WASM 330kB https://github.com/slockit/in3-c WebApplication (decentralized RPC-Client in the Browser) or Mobile Applications
C/C++ 200kB https://github.com/slockit/in3-c IoT-Devices, can be integrated nicely on many micro controllers (like [zephyr-supported boards] (https://docs.zephyrproject.org/latest/boards/index.html) ) or anny other C/C++ -Application
Java 705kB https://github.com/slockit/in3-c Java-Implementation of a native-wrapper
Docker 2.6MB https://github.com/slockit/in3 For replacing existing clients with this docker and connect to incubed via localhost:8545 without the need to change the architecture
bash 400kB https://github.com/slockit/in3-c the in3-commandline utils can be used directly as executable within bash-script or on the shell

other Languages (like C#, Python, Go, Rust) will be supported soon (until then you can simply use the shared library directly).

For information on the in3-node, sources on github or readthedocs will help you.

For information on the in3 client implementation in C, please go in3-c or API Documentation.

Installation and Usage

npm

Installing the in3-client is as easy as installing other modules:

npm install --save in3

Import incubed with:

import In3Client from "in3"

Example

// import in3-Module
import In3Client from 'in3'

async function demo() {

    // use the In3Client as Http-Provider
    const in3 = new In3Client({
        proof         : 'standard',
        signatureCount: 1,
        requestCount  : 2,
        chainId       : 'mainnet',
        replaceLatestBlock: 10
    })

    // use the web3
    const block = await in3.eth.getBlock('latest')
    console.log(`Incubed signed block hash ${block.hash}`)
}
...
}

Example with Web3 (as Provider)

// import in3-Module
import In3Client from 'in3'
import Web3 from 'web3'

async function demo() {

    // use the In3Client as Http-Provider
    const web3 = new Web3(new In3Client({
        proof         : 'standard',
        signatureCount: 1,
        requestCount  : 2,
        chainId       : 'mainnet',
        replaceLatestBlock: 10
    }).createWeb3Provider())

    // use the web3
    const block = await web3.eth.getBlock('latest')
    console.log(`Incubed signed block hash ${block.hash}`)
}
...
}

Detailed examples with usage of in3 in typescript programs can be found here.

Features

in3 Remote Client Light Client
Failsafe connection ✔️ ✔️
Automatic Nodelist updates ✔️ ✔️
Partial nodelist ✔️ ✔️
Multi-chain support ✔️ ✔️
Full verification of JSON-RPC methods ✔️
IPFS support ✔️ ✔️
Caching support ✔️
Proof-Levels ✔️
POA Support ✔️ ✔️ ✔️
Database setup size-minutes 0-instant️ 0-instant ~50Mb-minutes️
Uses IoT devices,Mobile,browser️ Mobile,browser️️ PC,Laptop️

Resources

Contributors welcome!

We at Slock.it believe in the power of the open source community. Feel free to open any issues you may come across, fork the repository and integrate in your own projects. You can reach us on various social media platforms for questions.

Twitter Blog Youtube LinkedIn Gitter

Got any questions?

Contact us on Gitter or send us an email at [email protected]

in3-legacy's People

Contributors

byuidahokid2018 avatar chirag-parmar avatar junaidev avatar makue1105 avatar simon-jentzsch avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

in3-legacy's Issues

docker image removed

trying to follow the documentation here: https://in3.readthedocs.io/en/latest/getting_started.html#registering-a-own-in3-node

I am getting:

✓ ~/g/t/test docker-compose -f dockcker-compose.yml  up -d
Creating network "test_default" with the default driver
Pulling incubed-server (slockit/in3-server:latest)...
ERROR: The image for the service you're trying to recreate has been removed. If you continue, volume data could be lost. Consider backing up your data before continuing.

Continue with the new image? [yN]y
Pulling incubed-server (slockit/in3-server:latest)...
ERROR: pull access denied for slockit/in3-server, repository does not exist or may require 'docker login'

404 for link in README

was very excited to read: "Java-Implementation of a native-wrapper" but then clicked on in and got a 404 :-(

In3 examples don't work.

Steps to reproduce

I am trying to create a web app using the instructions from here:
https://in3.readthedocs.io/en/latest/api-ts.html
and following the examples from here:
https://github.com/slockit/in3/blob/master/examples/src/in3DirectAPI.ts
and I can't get anything to log out.

my versions of in3 and web3 are:

   "web3": "^1.2.9"
    "in3": "^2.1.3",

And I'm using a normal NodeJS server with Express.
This is all I get:

UnhandledPromiseRejectionWarning: Error: tried eth_getBlockByNumber("0x0",false) to https://in3-v2.slock.it/mainnet/nd-2 but failed and can not recover (No nodes found that fullfill the filter criteria ) from wrong response  : Error: No nodes found that fullfill the filter criteria

And this is after a day of trying to request different hashes by blocks, numbers, etc.. The previous error is by copying the code from : https://github.com/slockit/in3/blob/master/examples/src/in3DirectAPI.ts

Expected behavior

Anything should login when I try to get information with the hash given in the test.

Actual behavior

I get errors.

Screenshot 2020-07-06 at 21 02 17

System configuration

MacOS 10.15.1

Incubed version

"in3": "^2.1.3",

Request

Incubed Configuration

Chain

data in client.ts should be language agnostic

currently this tightly couples to typescript. I want to use it e.g. for native android - using ts would be a mistake there. So it would be great if the data defined in client.ts could live e.g. in a json - ideally in a separate repository.

implement filters in the Client

This should create a id inside the Client and triggers a request
whenever eth_getFilterChanges is called.

Here we should support

  • eth_newFilter
    -> call eth_getLogs with the last checked blockNumber

  • eth_newBlockFilter
    -> call eth_getBlockNumber and the fetch all blocks after the last checked blockNumber

  • eth_newPendingTransactionFilter ( not supported )

  • tests implemented

make in3-ts public

  • add wiki
  • add at least README.md to document the usage
  • add browserify to bundle for browser
  • split server and client

implement eth_getLogs

in order to proof, we can do the following:

we should include all blockheaders (and let them sign) + the transactionreceipt and its merkle-proof of the tx containing logs for the given filter.
Buf of course we are not able to proof a not existence of a log, except if we would deliver all blockheaders in the search range. But this could be a lot! But maybe it would be enough to sign only the last one, since the others can be verified through the parentHash.

implement all opcodes with proofs and values for 'eth_call'

  • BALANCE
  • EXTCODESIZE
  • EXTCODECOPY
  • BLOCKHASH
  • COINBASE ( since we are currently not using a real block!)
  • TIMESTAMP
  • NUMBER
  • DIFFICULTY
  • GASLIMIT
    // and we need to check if the target contract exists (even though it would most likely fail if not)
  • CALL
  • CALLCODE
  • DELEGATECALL
  • STATIONCALL

[Docker] Incubed server can't decode private private key on startup

Tried to run Incubed server using docker-compose.yml from this repo. Unfortunately it fails on startup saying Could not decode the private (see full log below). Tried different key JSON files (generated by geth, parity, myCrypto) with the same result:

incubed-server_1  | no config found (Error: ENOENT: no such file or directory, open 'config.json')! using defaults
incubed-server_1  | Error starting the server : Could not decode the private : ethUtil.sha3(...).replace is not a function { port: 8500,
incubed-server_1  |   chains: 
incubed-server_1  |    { '0x5': 
incubed-server_1  |       { rpcUrl: 'http://localhost:8545',
incubed-server_1  |         privateKey: '/secure/myKey.json',
incubed-server_1  |         minBlockHeight: 6,
incubed-server_1  |         registry: '0x85613723dB1Bc29f332A37EeF10b61F8a4225c7e',
incubed-server_1  |         registryRPC: '',
incubed-server_1  |         privateKeyPassphrase: '123456789' } },
incubed-server_1  |   logging: { colors: true } }
incubed-server_1  | error: Error starting the server Error: Could not decode the private : ethUtil.sha3(...).replace is not a function port=8500, rpcUrl=http://localhost:8545, privateKey=/secure/myKey.json, minBlockHeight=6, registry=0x85613723dB1Bc29f332A37EeF10b61F8a4225c7e, registryRPC=, privateKeyPassphrase=123456789, colors=true
in3-server_incubed-server_1 exited with code 1

CodeCache in client.

Since the client will most likely use the same contracts the code is immutable, it makes sense to cache the contract code instead of getting them from the server in each eth_call request.
But then the client must check the proof for codehashes and ask for the code if needed.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.