Web 3.0 Realized with Traceless Privacy and Seamless Compatibility

Overview

Rust Docker

Automata

Build

On Ubuntu/Debian (or similar distributions on WSL), install the following packages:

sudo apt-get update
sudo apt-get install -y build-essential pkg-config llvm-dev libclang-dev clang libssl-dev curl

Install Rust through rustup.rs:

curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh

Initialize your Wasm Build environment:

./scripts/init.sh

Build Wasm and native code:

cargo build --release

Run

Start a local testnet using latest docker image:

./scripts/run-network.sh

Start a local testnet using locally built image to evaluate local changes:

./scripts/run-network.sh --build

License

Apache 2.0

Comments
  • Rpc for geode

    Rpc for geode

    1. Add two jsonrpc for geode. Both functions have no params.

      1. attestor_list() -> Vec<(Vec<u8>, Vec<u8>)> Return the registered attestors' “url” and “pubkey” by vector

      2. registered_geodes() -> Vec<Geodes> Return the registered(not attested) geodes' record by vector

    2. Set time limit to u64::max_value() in case that geode which registered but can't get enough attestors at limited blocks will be deleted. This is because we need a long time runing geode which is registered but not attested currently.

    opened by Ljiacheng 3
  • EVM - Substrate bidirectional transfer

    EVM - Substrate bidirectional transfer

    Changes inclued in this PR:

    1. Add transfer pallet, support 2 kinds of extrinsics: transfer_to_evm_account(signed extrinsic), transfer_from_evm_account(unsigned extrinsic)
    pub fn transfer_to_evm_account(
                origin: OriginFor<T>,
                target_address: H160,
                value: BalanceOf<T>,
            ) -> DispatchResultWithPostInfo
    // message: source account address(H160, 0-19 bytes), target account address(AccountId32, 20-51 bytes), amount(u128, 52-67 bytes), nonce(u32, 68-71 bytes)
    // signature: 65 bytes
    pub fn transfer_from_evm_account(
                _origin: OriginFor<T>,
                message: [u8; 72],
                signature_raw_bytes: [u8; 65]
            ) -> DispatchResultWithPostInfo
    
    1. Add 2 rpc methods, in transfer_to_substrate_account, will check balance, nonce, recovered signer and make sure params are legal hex string with specified length. If all checks pass, will submit a unsigned extrinsic transfer_from_evm_account
    #[rpc(name = "transfer_to_substrate_account")]
        fn transfer_to_substrate_account(
            &self, 
            message: String,
            signature: String
        ) -> Result<u64>;
    
        #[rpc(name = "transfer_nonce")]
        fn transfer_nonce(
            &self,
            evm_addr: String
        ) -> Result<u32>;
    
    opened by Liao1 1
  • Evm/Substrate address mapping

    Evm/Substrate address mapping

    We can use subkey to generate a sr25519 key pair, we will get the Secret Seed and Account ID, Account ID is the substrate address(let us call it as addressA), and you can genarate the private key using this secret seed. Besides, we can import the generated private key into Metamask and get a corresponding evm address(call it addressB), but actually these 2 addresses are address of 2 different account. We can do a experimentation:

    1. using the evm address we get above to get 10 testnet ATA from faucet
    2. import the substrate address into blockchain explorer
    3. get balance of the imported account in step#2(Developer -> Chain state -> system -> account) We will find tha balance of the imported account is not 10, actually is 0 if it is a new generated account

    Then you can use code below to calculate a substrate address from the evm address, <evm address> is the address in Metamask without leading 0x

    use blake2::VarBlake2b;
    use blake2::digest::{Update, VariableOutput};
    use hex;
    
    fn main() {
        // create a Blake2b object
        let mut hasher = VarBlake2b::new(32).unwrap();
    
        // write input message
        let mut data = [0_u8; 24];
        data[0..4].copy_from_slice(b"evm:");
        data[4..24].copy_from_slice(&hex::decode("<evm address>").unwrap());
    
        hasher.update(&data);
    
        // read hash digest and consume hasher
        let _res = hasher.finalize_variable(|res| {
            println!("{:?}", hex::encode(&res[..]));
        });
    }
    

    you will get a string like 65f5fbd10250447019bb8b9e06f6918d033b2feb6478470137b1a552656e2911 by running code above, then come back to blockchain explorer, paste the string here(we will get a another address, call it addressC ) and call account function: image you will find that balance of this account is 10 ATA(or 10 BATA) The result verifies that actually addressA and addressB are 2 different account in our chain, addressB and addressC are same account in our chain. Currently, assume that someone have some ata in his evm address account, and he want to interact(send extrinsics) with our chain, it is impossible because he doesn't know the private key of corresponding substrate address. So maybe we need to change the mapping methods in evm pallet, take the previous example, we should mapping addressA to addressB

    enhancement 
    opened by Liao1 1
  • fix memory leak

    fix memory leak

    Fix the memory leak. It is caused by crate "thread_local" and the crate fix the BUG at "1.1.3". You can just run "cargo update -p thread_local" or update the repository. Just ensure the version of "thread_local" in your cargo.lock is "1.1.3".

    Talk about memory leak in substrate: discussion Fix at substrate: fix cargo.lock Fix at thread_local: drop the value

    opened by Ljiacheng 1
  • Add test node which use

    Add test node which use "aura" instead of "babe"

    Use "aura" consensus algoritm instead of "babe" for development test. Here are some points:

    1. Every session contains 10 blocks which can be changed in runtime.

    2. There are three mode to run: "dev", "local" and "staging". "dev" is a single node mode and please run the command: "./target/release/automata purge-chain --dev -y" before you run: "./target/release/automata --dev".

      "local" mode needs two validators and "staging" needs four validators.

    opened by Ljiacheng 1
  • Adds an Aura Consensus algorithm to Runtime

    Adds an Aura Consensus algorithm to Runtime

    Now start the development network using the BABE algorithm.If there is only a single node, the network will not function properly after being shut down for a period of time, which is not conducive to internal testing.

    So it makes more sense to change the BABE algorithm to the AURA algorithm.

    The error message:

    ClientImport("Unexpected epoch change")  
    
    opened by Kayryu 1
  • Enable Geode State Subscription

    Enable Geode State Subscription

    This patch enables the automata node to accept subscriptions for the state of a geode via the "geode_subscribeState" RPC method.

    The subscription mechanism is implemented by getting storage updates: the subscribe method creates a stream over which it receives notifications when the storage value of the geode is updated; the storage value is converted to a GeodeState that is sent to the Subscriber.

    opened by oana-barbu 0
  • Problematic implements

    Problematic implements

    1. Need to check if the instance exist before using it (will not record issues in fulfillment pallet, since this pallet will be removed) After the block has been initialized, each valid extrinsic is executed in order of transaction priority. Extrinsics must not cause a panic in the runtime logic or else the system becomes vulnerable to attacks where users can trigger computational execution without any punishment. --Substrate Developer Hub https://github.com/automata-network/automata/blob/3b11d5502f66908a190f02613e630caac80f0a4c/pallets/attestor/src/lib.rs#L218-L219
    opened by Liao1 0
  • Robustify Attestor

    Robustify Attestor

    There is a corner case that could cause the chain having dirty data:

    If an attestor get disconnected from chain, and not going to come back, the geode that it was attesting will remain in Registered state forever, and no one would be responsible for checking the liveness of that geode to ensure it's in proper status.

    Thus here are some TODOs for eliminate this corner case:

    1. Attestor should maintain a way of informing the chain about its status periodically, if it failed to do so in a timeout, the chain should mark it as an offline attestor.
    2. As geode needs to be attested by a certain amount of attestors to get its state changed into attested(currently the amount is 1), while attestor could be offline at any moment, the geode needs a way to keep themselves aware of the situation on chain, and try to find new attestor as soon as possible to meet required number of attestors, otherwise it could be marked as degraded, or even worse: if no attestor is attesting it, will be marked as unknown.
    3. While it's true that geode can poll the chain to gets the information from chain, it would definitely be more ideal if the Geode can subscribe the Event emitted from the chain.
    enhancement 
    opened by RyuH1 1
  • Runing automata net on frsh Ubuntu 21.04

    Runing automata net on frsh Ubuntu 21.04

    Hi, I conduct build process according to instaction I have installed docker and docker-compose

    I have this problem:

    a@s:~/progs/automata$ sudo ./scripts/run-network.sh
    [sudo] hasło użytkownika adi: 
    Running the network
    Image: automata
    Chain: local
    Pulling validator-a (automata:)...
    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 validator-a (automata:)...
    ERROR: pull access denied for automata, repository does not exist or may require 'docker login': denied: requested access to the resource is denied
    a@s:~/progs/automata$ ./scripts/run-network.sh
    Running the network
    Image: automata
    Chain: local
    ERROR: Couldn't connect to Docker daemon at http+docker://localhost - is it running?
    
    If it's at a non-standard location, specify the URL with the DOCKER_HOST environment variable.
    a@s:~/progs/automata$ 
    

    How I can make automata running?

    opened by adamvm 0
  • Error during building: `prost-build v0.7.0`, The PROTOC environment variable is not set

    Error during building: `prost-build v0.7.0`, The PROTOC environment variable is not set

    pi@pi4:~/automata $ cargo build --release Compiling sct v0.6.0 Compiling webpki v0.21.4 Compiling wasm-timer v0.2.5 Compiling rw-stream-sink v0.2.1 Compiling soketto v0.4.2 Compiling yamux v0.8.1 Compiling libp2p-pnet v0.20.0 Compiling intervalier v0.4.0 Compiling futures-diagnose v1.0.1 Compiling exit-future v0.2.0 Compiling prost-build v0.7.0 error: failed to run custom build command for prost-build v0.7.0

    Caused by: process didn't exit successfully: /home/pi/automata/target/release/build/prost-build-0f2fe0256215a37a/build-script-build (exit code: 101) --- stderr thread 'main' panicked at 'Failed to find the protoc binary. The PROTOC environment variable is not set, there is no bundled protoc for this platform, and protoc is not in the PATH', /home/pi/.cargo/registry/src/github.com-1285ae84e5963aae/prost-build-0.7.0/build.rs:100:10 note: run with RUST_BACKTRACE=1 environment variable to display a backtrace warning: build failed, waiting for other jobs to finish... error: build failed pi@pi4:~/automata $

    opened by adamvm 1
Releases(v0.1.1)
Owner
Automata Network
Web 3.0 Realized with Tracless Privacy and Seamless Compatibility
Automata Network
A simple and fast linear algebra library for games and graphics

glam A simple and fast 3D math library for games and graphics. Development status glam is in beta stage. Base functionality has been implemented and t

Cameron Hart 953 Jan 3, 2023
A Markdown to HTML compiler and Syntax Highlighter, built using Rust's pulldown-cmark and tree-sitter-highlight crates.

A blazingly fast( possibly the fastest) markdown to html parser and syntax highlighter built using Rust's pulldown-cmark and tree-sitter-highlight crate natively for Node's Foreign Function Interface.

Ben Wishovich 48 Nov 11, 2022
Text calculator with support for units and conversion

cpc calculation + conversion cpc parses and evaluates strings of math, with support for units and conversion. 128-bit decimal floating points are used

Kasper 82 Jan 4, 2023
A command-line tool and library for generating regular expressions from user-provided test cases

Table of Contents What does this tool do? Do I still need to learn to write regexes then? Current features How to install? 4.1 The command-line tool 4

Peter M. Stahl 5.8k Dec 30, 2022
Find and replace text in source files

Ruplacer Find and replace text in source files: $ ruplacer old new src/ Patching src/a_dir/sub/foo.txt -- old is everywhere, old is old ++ new is ever

Tanker 331 Dec 28, 2022
An efficient and powerful Rust library for word wrapping text.

Textwrap Textwrap is a library for wrapping and indenting text. It is most often used by command-line programs to format dynamic output nicely so it l

Martin Geisler 322 Dec 26, 2022
An implementation of regular expressions for Rust. This implementation uses finite automata and guarantees linear time matching on all inputs.

regex A Rust library for parsing, compiling, and executing regular expressions. Its syntax is similar to Perl-style regular expressions, but lacks a f

The Rust Programming Language 2.6k Jan 8, 2023
Rust edit distance routines accelerated using SIMD. Supports fast Hamming, Levenshtein, restricted Damerau-Levenshtein, etc. distance calculations and string search.

triple_accel Rust edit distance routines accelerated using SIMD. Supports fast Hamming, Levenshtein, restricted Damerau-Levenshtein, etc. distance cal

Daniel Liu 75 Jan 8, 2023
Text Expression Runner – Readable and easy to use text expressions

ter - Text Expression Runner ter is a cli to run text expressions and perform basic text operations such as filtering, ignoring and replacing on the c

Maximilian Schulke 72 Jul 31, 2022
💥 Fast State-of-the-Art Tokenizers optimized for Research and Production

Provides an implementation of today's most used tokenizers, with a focus on performance and versatility. Main features: Train new vocabularies and tok

Hugging Face 6.2k Jan 5, 2023
Rust native ready-to-use NLP pipelines and transformer-based models (BERT, DistilBERT, GPT2,...)

rust-bert Rust native Transformer-based models implementation. Port of Hugging Face's Transformers library, using the tch-rs crate and pre-processing

null 1.3k Jan 8, 2023
👄 The most accurate natural language detection library in the Rust ecosystem, suitable for long and short text alike

Table of Contents What does this library do? Why does this library exist? Which languages are supported? How good is it? Why is it better than other l

Peter M. Stahl 569 Jan 3, 2023
Semantic text segmentation. For sentence boundary detection, compound splitting and more.

NNSplit A tool to split text using a neural network. The main application is sentence boundary detection, but e. g. compound splitting for German is a

Benjamin Minixhofer 273 Dec 29, 2022
A fast, low-resource Natural Language Processing and Text Correction library written in Rust.

nlprule A fast, low-resource Natural Language Processing and Error Correction library written in Rust. nlprule implements a rule- and lookup-based app

Benjamin Minixhofer 496 Jan 8, 2023
Rust-tokenizer offers high-performance tokenizers for modern language models, including WordPiece, Byte-Pair Encoding (BPE) and Unigram (SentencePiece) models

rust-tokenizers Rust-tokenizer offers high-performance tokenizers for modern language models, including WordPiece, Byte-Pair Encoding (BPE) and Unigra

null 165 Jan 1, 2023
Read and modify constituency trees in Rust.

lumberjack Read and process constituency trees in various formats. Install: From crates.io: cargo install lumberjack-utils From GitHub: cargo install

Sebastian Pütz 10 Apr 28, 2022
Locate Args and Execute

Lax An argument substitution utility intended to make working on projects with deeply nested directories a bit easier. "Lax" stands for "Locate Args a

Dagan Martinez 18 Apr 2, 2022
Simple, extendable and embeddable scripting language.

duckscript duckscript SDK CLI Simple, extendable and embeddable scripting language. Overview Language Goals Installation Homebrew Binary Release Ducks

Sagie Gur-Ari 356 Dec 24, 2022
Fast and easy random number generation.

alea A zero-dependency crate for fast number generation, with a focus on ease of use (no more passing &mut rng everywhere!). The implementation is bas

Jeff Shen 26 Dec 13, 2022