Git Product home page Git Product logo

bitconch / bitconch-core Goto Github PK

View Code? Open in Web Editor NEW
203.0 17.0 93.0 704.94 MB

A new distributed web protocol for smart contracts and decentralized applications.

License: MIT License

Dockerfile 0.01% Makefile 1.06% Solidity 1.24% Go 1.44% Shell 3.43% C 8.47% Rust 2.49% Python 5.81% C++ 72.20% CMake 1.86% M4 0.11% Java 0.02% HTML 1.85%
blockchain distributed-database crytpocurrency dlt distributed-ledger rust golang

bitconch-core's Introduction

Bitconch

A New Distributed Web Protocol for Smart Contracts and DApps.

This repo is the official implementation of the Bitconch Chain protocol.

Testnet

There are two channels of testnet stable and nightly.

We provided installation scripts for install stable version of Bitconch chain, code-name "Buffett" on the local machine.

Build and Deploy

Ubuntu

  1. run preset.sh to install pre-requisits
preset.sh
pip3 install colorama
  1. deploy the Bitconch
./deploy-stable.py

Windows

WIP

For first time user on windows

  1. Download and install Chcolate https://chocolatey.org/

  2. Install mingw, go, rust

  3. Download and install Visutal Studio Code https://code.visualstudio.com/

  4. Register an account on Github.com

  5. Download the Github desktop client from https://desktop.github.com

  6. Clone this repo to your own local

  7. Modify the code as you wish.

  8. Commit the changes to your local repo. And push to your own remote repo.

  9. Please make sure your contributions adhere to our coding guidelines:

    • Code must adhere to the official Go formatting guidelines (i.e. uses gofmt).
    • Code must be documented adhering to the official Go commentary guidelines.
    • Pull requests need to be based on and opened against the master branch.
    • Commit messages should be prefixed with the package(s) they modify.
      • E.g. "consensus: add new pckage buffett for POR consensus"

How to contribute (Bitconch Improvement Proposal - BUSIP)


People wishing to submit BUSIPs, first should propose their idea or document to the issue tab. After discussion, please open a PR. After copy-editing and acceptance, it will be published here.

We are fairly liberal with approving BIPs, and try not to be too involved in decision making on behalf of the community. The exception is in very rare cases of dispute resolution when a decision is contentious and cannot be agreed upon. In those cases, the conservative option will always be preferred.

Having a BIP here does not make it a formally accepted standard until its status becomes Final or Active.

Magna Carta of Bitconch

Bitconch is dedicated to build a global community of developers. This part is still in WIP, please post your ideas to the issue with tag of #BUSIP

bitconch-core's People

Contributors

aya015757881 avatar bcoojohn avatar binsgit avatar caesarchad avatar cc-cara avatar luhuimao avatar mikelbitconch avatar n1eo avatar tingkaihu avatar wgfsimple avatar yukunlee 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  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  avatar  avatar  avatar  avatar  avatar

bitconch-core's Issues

Bitconch MVP Testnet

Change Log

  • Aug 22, 2018

    • First proposal for Bitconch MVP Testnet.
  • Sep 12, 2018

    • Add more tracking number.

Bitconch MVP Testnet

MVP stands for Minimum Viable Product, per wikipedia, MPV is a product with just enough features to satisfy early customers, and to provide for future product development.

Tracking convention, for each modified part of codes, adding tracking number.

BUS001 ( Tracking No. )

Add new consensus engine POR
Createa a new package “buffett”, which implements the proof-of-reputation consensu algorithm.

No. Src File Path Description
1 flags.go cmd\utils\flags.go Modify
2 api.go consensus\buffett New
3 buffett.go consensus\buffett New
4 snapshot.go consensus\buffett New
5 snapshot_test.go consensus\buffett New
6 backend.go eth Modify
7 web3ext.go internal\web3ext Modify
8 worker.go miner Modify

BUS002

  • Create a new state "Reputation", this is similar to "Account Nonce"
  • Create corresponding methods for the Reputation state.

BUS003

  • Create a new CLI command "bus"
  • Run CLI command bus will start Bitconch MVP Testnet in POR mode.

BUS004

  • Change the underlying token name to BUS
  • Change all the related Print Info to BUS or Bitconch

BUS005

  • Replace the existing hash function with hight speed blake2b. Details refer to this link #11

BUS006

  • Increase TPS further : Increase pending transaction pool.

BUS007

  • Increase TPS further : Replace levelDB
    #19

BUS008

  • Increase TPS further : Implement Plasma architecture
    #20

BUS009

  • Increse TPS further : Increse gasLimit per block, aka each block can contains more txs

Rust Interview Questions

(1) What is Rust Programming?
A. Rust is a systems programming language focused on safety, speed and concurrency.
B. Rust is syntactically similar to C++, but its designers intend it to provide better memory safety while still maintaining performance.
C. Rust is a statically typed language.
D. All of them.

(2) What are the advantages of Rust?
A. Predictable clean-up of resources and avoids the need for GC through.
B. Lower overhead for memory management.
C. Essentially no runtime system and avoids the need for GC through.
D. All of them.

(3) What are the disadvantages of Rust?
A. Rust compilation seems slow and Rust use of LLVM for code generation.
B. Rust has a moderately-complex type system.
C. The Rust compiler does not compile with optimizations unless asked to, as optimizations slow down compilation and are usually undesirable during development.
D. All of them.

(4) What Are the Differences between the two different string types?
A. The “String” is an owned buffer of UTF-8 bytes allocated on the heap.
B. The “Strings” is Mutable and it can be modified.
C. The “&str” is a primitive type and it is implemented by the Rust language while String is implemented in the standard library.
D. All of them.

(5) What Are the rules for using self, &self, or &mut self in a method declaration?
A. The “self” is use, when a function needs to consume the value.
B. The “&self” is use, when a function only needs a read-only reference to the value.
C. The “&mut self” is use, when a function needs to mutate the value without consuming it.
D. All of them.

(6) What Is the relationship between a module and a crate?
A. Module - A module is a unit of code organization inside a crate.
B. Crate - A Crate is a compilation unit and it contains an implicit and un-named top-level module.
C. A and B.
D. None.

(7) Which is correct according to Cargo?
A. Cargo is Rust’s build system and package manager.
B. Cargo downloads your Rust project’s dependencies and compiles your project.
C. A and B
D. None

(8) What happened if you used cargo to create a new project?
A. A new directory will generated with the name you specified.
B. There are two files and one directory under the project root directory.
C. Will initialized a new Git repository along with a .gitignore file.
D. All of them.

(9) How to build and run your Rust project?
A. cargo build
./target/debug/your projectname
B. cargo run
C. A and B
D. None

(10) How to get the contents that user types into standard input and place it into a string ?
A. let mut buffer = String::new();
std::io::stdin().read_line(&mut buffer);
B. use std::io;
let mut buffer = String::new();
Io::stdin().read_line(&mut buffer);
C. let mut buffer = String::new();
std::io::stdin().read_to_string(&mut buffer);
D. All of them.

(11) How to printing values with println!?
A. println!(“Hello World!”);
B. println!(“{}”, “Hello World!);
C. A and B.
D. None.

(12) What is immutable variable in Rust?
A. When a variable is immutable, once a value is bound to a name, you can’t change that value.
B. By fault variables are immutable.
C. A and B.
D. None.

(13) What differences between Variables and Constants?
A. You declare constants using the “const” keyword instead of “let” keyword.
B. Constants can be declared in any scope.
C. Constants may be set only to a constant expression, not the result of a function call or any other value that could only be computed at runtime.
D. All of them.

(14) What are scalar types in Rust?
A. Integers.
B. Floating-point numbers.
C. Booleans.
D. Characters.

(15) What are primitive compound types in Rust?
A. Tuples.
B. Arrays.
C. A and B.
D. None.

(16) How to declare a new function a Rust?
A. Function main(){
println!(“Hello, world!”);
}
B. Functions main()
{
println!(“Hello, world!”);
}
C. Fn main() {
println!(“Hello, world!”);
}
D. None.

(17) According function parameters, which is correct in following options?
A. Function parameters don’t all need to be same type.
B. Your must declare the type of each parameter.
C. A and B.
D. None.

(18) What different between Statements and Expressions?
A. Statements are instructions that perform some action and do not return a value.
B. Expressions evaluate to something are make up most of the rest of the code in Rust.
C. A and B.
D. None.

(19) Which is correct according to functions return values?
A. We declare return values type after an arrow (->) instead of name the return values.
B. Return values of the function is synonymous with the value of the final expression in the block of body of a function.
C. We can return early from a function by using the “return” keyword and specifying a value, but most functions return the last expression implicitly.
D. All of them.

(20) Which is correct according to “if” expressions?
A. let number = 3;
if number {
println!(“number was three”);
}
B. let number = 3;
if number < 5 {
println!("condition was true");
} else {
println!("condition was false");
}
C. let condition = true;
let number = if condition {
5
} else {
6
};
D. let condition = true;
let number = if condition {
5
} else {
"six"
};

(21) What’s the output of the following?
fn main() {
let mut counter = 0;
let result = loop {
counter += 1;
if counter == 10 {
break counter * 2;
}
};
println!(result);
}
A. 10
B. 20
C. 4
D. 0

(22) What is Ownership in Rust?
A. Each value in Rust has a variable that’s called its owner.
B. There can only be one owner at a time.
C. When the owner goes out of scope, the value will be dropped.
D. All of them.

(23) What is true about References in Rust?
A. At any given time, you can have either (but not both of) one mutable reference or any number of immutable references.
B. References must always be valid.
C. A and B
D. None

(24) What is true about Slice type in Rust?
A. Slice is a data type does not have ownership .
B. Slices let you reference a continuous sequence of elements in a collection rather than the whole collection.
C. A and B.
D. None.

(25) What is the output of the following ?
fn main() {
let mut s = String::from("hello world");
let word = first_word(&s);
println!(“{}”, word);
}

fn first_word(s: &String) -> usize {
let bytes = s.as_bytes();
for (i, &item) in bytes.iter().enumerate() {
if item == b' ' {
return i;
}
}
s.len()
}
A. 0
B. 3
C. 1
D. 5

(26) What is the output of the following?
fn main() {
let a = [1, 2, 3, 4, 5];
let slice = &a[1..3];
for (i, &item) in slice.iter().enumerate() {
print!("{}", item);
}
}
A. 12
B. 45
C. 23
D. 34

(27) What is the difference between Structs and tuples?
A. The pieces of a struct should only be same type.
B. Use “struct” keyword to define a struct.
C. Each piece of data of a struct has it’s name so you don’t have to rely on the order of the data to specify or access the values of an instance.
D. All of them.

(28) What is the difference between Methods and Functions?
A. Methods are defined within the context of a struct(or an enum or a trait object).
B. Method’s first parameter is always self, which represents the instance of the struct the method is being called on.
C. A and B.
D. None.

(29) What is output of the following ?
fn main() {
let rect1 = Rectangle { width: 30, height: 50 };
println!(
"{}",
rect1.area()
);
}
struct Rectangle {
width: u32,
height: u32,
}
impl Rectangle {
fn area(&self) -> u32 {
self.width * self.height
}
}
A. 100
B. 300
C. 1500
D. 2000

(30) Which is true about Modules in Rust?
A. The mod keyword declares a new module. Code within the module appears either immediately following this declaration within curly brackets or in another file.
B. By default, functions, types, constants, and modules are private. The pub keyword makes an item public and therefore visible outside its namespace.
C. The use keyword brings modules, or the definitions inside modules, into scope so it’s easier to refer to them.
D. A module is a namespace that contains definitions of functions or types, and you can choose whether those definitions are visible outside their module (public) or not (private).

(31) What is Vector in Rust?
A. Vectors allow you to store more than one value in a single data structure that puts all the values next to each other in memory.
B. Vectors can only store values of the same type.
C. A and B.
D. None.

(32) What is the output of the following?
fn main() {
let mut v = vec![100, 32, 57];
for i in &mut v {
*i += 50;
}
print!("{}", v[1])
}
A. 82
B. 150
C. 107
D. 132

(33) What is the output of the following?
fn main() {
let mut s = String::from("foo");
s.push_str("bar");
print!("{}", s)
}
A. foo
B. bar
C. foobar
D. barfoo

(34) What is the output of the following?
fn main() {
let number_list = vec![34, 50, 25, 100, 65];
let mut largest = number_list[0];
for number in number_list {
if number > largest {
largest = number;
}
}
println!("{}", largest);
}
A. 34
B. 50
C. 25
D. 100

(35) What is Traits in Rust?
A. A trait tells the Rust compiler about functionality a particular type has and can share with other types.
B. We can use traits to define shared behavior in an abstract way.
C. We can use trait bounds to specify that a generic can be any type that has certain behavior.
D. Traits are similar to a feature often called interfaces in other languages.

Technical Weekly Report (Mar 3th - Mar 17th)

For the past two weeks we focused on the following parts:

  • Dashboard

We were making a dashboard that show numbers related to transactions such as Max transactions per second, Total transactions, Max confirmation, Confirmation (99th percentile) etc. With this kind of digital dashboards allow developer to monitor the system performance, a digital dashboard also allow you to capture and report specific data points from counters.

Our dashboard mainly consist of two components:

  1. Grafana
    Grafana is a great tool for beautiful monitoring and metric analytics & dashboards. More details via https://grafana.com
  2. Influxdb
    We chose Influx db as the database of dashboard due to it is optimized for fast, high-availability storage and retrieval of time series data in fields, so Influx db is the best choice for application metrics.
  • Explorer

We were making an explorer shows the latest/all block info (mined time, miner info , amount of transaction included in the block etc.) and the transactions info (confirmed time, recipient address, sender address, fees etc.), and let user search by address, hash of transaction, block , token etc.

Ninety percent is done now.

  • Nginx

Nginx was successfully deployed on our test server now.
We use Nginx as our web server due to it's ability to handle more than 10,000 simultaneous connections with a low memory footprint (~2.5 MB per 10k inactive HTTP keep-alive connections). Nginx uses an asynchronous event-driven approach, rather than threads, to handle requests.[22] Nginx's modular event-driven architecture can provide more predictable performance under high loads.

  • Wallet APP

Following features are complemented now:

  1. Generate user account address
  2. Import/Export private keys
  3. Token transferring

Technical Weekly Report (Oct 13th ~ Nov 27th)

BLAZE

  • We have tested our new tool for GPU/CPU multicore hash function, you can find the codes from here, which will be open to public test in December.

Magna Carta of Bitconch

  • We have just finished our first draft version for our coders' guide and community constitution, aka - Magna Carta of Bitconch, this version is still in its very early conceptual phase, and it is open for discussion.

Awesome List

  • To help the new comers to integrate into our dev community, we have compiled an awesome list about everything you need to know about our technology. For enthusiasts, developers and researchers, all the comments and questions are welcome.

Apply new elliptic curve encryption in Bitconch (Ed25519)

Ed25519 has much better properties than ECDSA with secp256k1.
https://safecurves.cr.yp.to/ (joint work between Daniel J. Bernstein, University of Illinois at Chicago, USA, and Tanja Lange, Technische Universiteit Eindhoven, Netherlands) has rated Curve25519 as "safe"

The specific reasons why CryptoNote creators chose Curve25519 are unclear but it appears to be trusted by top cryptographers.

Monero developers trust DJB, Curve25519 and the fast Schnorr algo (EdDSA).

Ed25519 is a specific instance of the EdDSA family of signature schemes. Ed25519 is specified in RFC 8032 and widely used. The only other instance of EdDSA that anyone cares about is Ed448, which is slower, not widely used, and also specified in RFC 8032. Keys and signatures in one instance of EdDSA are not meaningful in another instance of EdDSA: Ed25519 and Ed448 are different signature schemes.

The ECDSA family of signature schemes is not related to EdDSA, except in that the mathematics behind it also involves elliptic curves. Any particular instance of ECDSA, such as ECDSA over the curve secp256k1 with SHA-256 (as Bitcoin uses), is incompatible with any other instance of it, such as ECDSA over the curve nistp521 with SHA-512.

On a practical level, what a user might need to know is that Ed25519 keys are not compatible in any meaningful sense with keys in any instance of ECDSA. So, e.g., in the ssh protocol, an ssh-ed25519 key is not compatible with an ecdsa-sha2-nistp521 key, which is why they are marked with different types. Similarly, an ssh-ed448 key, for Ed448, is incompatible, which is why it is also marked with a different type.

On a technical level, what a protocol designer should know is that the ECDSA family of signature schemes is an archaic slow design that encourages security-destroying implementation errors, while the EdDSA family of signature schemes is a modern design that avoids those errors.

FYI https://forum.ethereum.org/discussion/comment/53/#Comment_53
We should create a new function to apply the Ed25519 encrytpion.

Technical Weekly Report (Feb 15th - Mar 2th)

For the passing 15 days we are dedicated to improve the performance by focusing on following parts:

  1. A high performance smart contract template which allow user easily to create and release a smart contract such as create a new token, etc.
  2. Wallet provides functionalities that transfer cryptocurrencies, etc.
  3. An explorer provides functionalities to check transaction status, account balance .etc
  4. A Faucet system that awards users bus coin for completing tasks.
  5. Code Base including all the source code, configuration, property files, the source code is retained, either as a collection of files or in a source control repository, so that changes can be made as necessary throughout the software's supported life.

Now all of these are under testing.

White Paper revisions

Add sections/chapters to address the following issues:

  1. Add new system layers fig like fandom/celer
  2. Add chapters/sections to address correctness issues(double spending, sybil attack, flood attack)
  3. Add chapters/sections to address the real-world application use case on Bitconch blockchain.

Cargo tests

The Rust community thinks about tests in terms of two main categories: unit tests and integration tests.

  • Unit tests are small and more focused, testing one module in isolation at a time, and can test private interfaces.
  • Integration tests are entirely external to your library and use your code in the same way any other external code would, using only the public interface and potentially exercising multiple modules per test.

Technical Weekly Report (April 1th - April 15th)

For the past half month we focus on the following parts:

  • New features testing for Android, IOS bitr .
  • Explorer optimization.
  • Faucet optimization.
  • Smart contract for create new tokens.
  • App Wallet optimization to improve user experience
  • Writing Bitconch SDK.

Call of Code : Use Go to make shared state.

we need some serious developer who could join our ranks. As a demonstration of your skills,please submit your code to github/bitconch/bus/issues

to implement a shared state between two seperate thread

Tip use automic operation in Go

TPS improvement

Implementation: Use plasma like architecture to scale the TPS for MVP test net.

Consensus Mechanism Interview Questions

(1) What’s consensus mechanism?
A. The purpose of a consensus mechanism is to verify that information being added to the ledger is valid.
B. Is a method of action for network or project creators to decide on changes to the decentralized system.
C. A consensus makes sure that an agreement is reached which could benefit the entire group as a whole, a method by which consensus decision-making is achieved is called “Consensus Algorithm”.
D. All of them.

(2) What are the most common consensus algorithms used by blockchain?
A. POW
B. POS
C. DPOS
D. PBFT

(3) What is POW?
A. POW is the first and most well-known consensus mechanism.
B. In Pow a miner who finds the hash first will be allowed to add a new block of the transaction to the blockchain.
C. The process of mining is extremely computation-intensive, so having a high hashrate is the key for miners to calculate the hash, thus getting the rewards.
D. All of them.

(4) What are the disadvantages of POW?
A. Huge expenditures.
B. Useless of computations.
C. 51 percent attack.
D. ALL of them.

(5) How do miners make sure they generate a hash below the target in Bitcoin network?
A. They alter the input by adding an integer, called a nonce(“number used once”).
B. Once a valid hash is found, it is broadcast to the network, and the block is added to the blockchain.
C. They ask other peers to get the valid hash.
D. None.

(6) How the miners to increate their chances of mining blocks?
A. Pool together.
B. Increate memory capacity.
C. Increate computing power.
D. Increate bandwidth.

(7) Why is say that Proof of work makes it extremely difficult to alter any aspect of the blockchain?
A. An alteration would require re-mining all subsequent blocks.
B. It is difficult for a user or pool of users to monopolize the network’s computing power, since the machinery and power required to complete the hash functions are expensive.
C. A and B.
D. None.

(8) What hash functions was used in Bitcoin?
A. BLAKE-256.
B. LBAKE2b.
C. SHA-256.
D. MD5.

(9) How Bitcoin network sets a certain level of difficulty of mining?
A. Increate the block size.
B. Setting the target hash starts with a long string of zeros: the lower the target, the smaller the set of valid hashed, and the harder it is to generate one.
C. A and B.
D. None.

(10) How POW work?
A. Take the current block of transactions and add it onto the hash of the previous block.
B. Pick a nonce and add it to the block of text.
C. Perform a hash of the block, the resulting hash needs to be a string that has a certain number of zeros in front of it.
D. If the hash lower than the target then broadcast to the network.

(11) What is Proof of stake?
A. Is a type of algorithm by which a cryptocurrency blockchain network aims to achieve distributed consensus.
B. Proof of stake requiring users to stake an amount of their tokens so as to have a chance of being selected to validate blocks of transactions.
C. In chain-based proof of stake, the algorithm pseudo-randomly selects a validator during each time slot (e.g. every period of 10 seconds might be a time slot), and assigns that validator the right to create a single block, and this block must point to some previous block.
D. In PoS-based public blockchains (e.g. Ethereum's upcoming Casper implementation), a set of validators take turns proposing and voting on the next block, and the weight of each validator's vote depends on the size of its deposit (i.e. stake).

(12) What are the benefits of proof of stake as opposed to proof of work?
A. No need to consume large quantities of electricity.
B. Because of the lack of high electricity consumption, there is not as much need to issue as many new coins in order to motivate participants to keep participating in the network.
C. Proof of stake opens the door to a wider array of techniques that use game-theoretic mechanism design in order to better discourage centralized cartels from forming.
D. Reduced centralization risks.

(13) How can be a block added to the chain in BFT-style proof of stake?
A. Validators are randomly assigned the right to propose blocks, but agreeing on which block is canonical is done through a multi-round process.
B. Every validator in this multi-round process sends a "vote" for some specific block during each round, and at the end of the process all (honest and online) validators permanently agree on whether or not any given block is part of the chain.
C. A and B.
D. None.

(14) What is the “nothing at stake” problem?
A. There are only rewards for producing blocks, and no penalties in many early (all chain-based) proof of stake algorithms, in the case that there are multiple competing chains, it is in a validator's incentive to try to make blocks on top of every chain at once.
B. May caused a blockchain never reach consensus even there are no attackers if all actors are narrowly economically rational.
C. A and B.
D. None.

(15) How to fix the “nothing at stake” problem?
A. involves penalizing validators if they simultaneously create blocks on multiple chains, by means of including proof of misbehavior (i.e. two conflicting signed block headers) into the blockchain as a later point in time at which point the malfeasant validator's deposit is deducted appropriately.
B. punish validators for creating blocks on the wrong chain.
C. A and B.
D. None.

(16) What is Raft?
A. It’s equivalent to Paxos in fault-tolerance and performance.
B. it's decomposed into relatively independent subproblems, and it cleanly addresses all major pieces needed for practical systems.
C. Raft will make consensus available to a wider audience, and that this wider audience will be able to develop a variety of higher quality consensus-based systems than are available today.
D. It solves the problem of getting multiple servers to agree on a shared state even in the face of failures.

(17) What is the possible results of leader election?
A. The candidate receives votes from the majority of the servers and becomes the leader. It then sends a heartbeat message to others in the cluster to establish authority.
B. If other candidates receive AppendEntries RPC, they check for the term number. If the term number is greater than their own, they accept the server as the leader and return to follower state. If the term number is smaller, they reject the RPC and still remain a candidate.
C. The candidate neither loses nor wins. If more than one server becomes a candidate at the same time, the vote can be split with no clear majority. In this case a new election begins after one of the candidates times out.
D. All of them.

(18) When a leader gets a client request, it adds it to its own log as a new entry, What is the contents of the log?
A. Contains the client specified command
B. Has an index to identify the position of entry in the log (the index starts from 1)
C. Has a term number to logically identify when the entry was written.
D. All of them.

(19) Each server exists in one of the three states, what are they?
A. Follower.
B. Candidate.
C. Leader.
D. All of them.

(20) What is Paxos?
A. Paxos is one of the oldest, simplest, and most versatile algorithms in the field of distributed consensus.
B. Paxos is a family of protocols for solving consensus in a network of unreliable processors.
C. The Paxos family of protocols includes a spectrum of trade-offs between the number of processors, number of message delays before learning the agreed value, the activity level of individual participants, number of messages sent, and types of failures.
D. All of them.

(21) Paxos describes the actions of the processors by their roles in the protocol:
A. Client.
B. Acceptor.
C. Proposer.
D. Learner and Leader.

(22) A successful round has two phases, what are they?
A. Prepare.
B. Promise.
C. Accept Request.
D. Accepted.

(23) What is OCC?
A. OCC is a concurrency control method applied to transactional systems such as relational database management systems and software transactional memory.
B. OCC assumes that multiple transactions can frequently complete without interfering with each other.
C. While running, transactions use data resources without acquiring locks on those resources.
D. Before committing, each transaction verifies that no other transaction has modified the data it has read. If the check reveals conflicting modifications, the committing transaction rolls back and can be restarted.

(24) What phases are involve in OCC transactions?
A. Begin: Record a timestamp marking the transaction’s beginning.
B. Modify: Read database values, and tentatively write changes.
C. Validate: Check whether other transactions have modified data that this transaction has used( read or written).
D. Commit/Rollback: If there is no conflict, make all changes take effect. If there is a conflict, resolve it, typically by aborting the transaction, although other resolution schemes are possible.

(25) When transaction wants to commit:
A. Send read/write info to server for “validation”.
B. Validation decides if OK to commit -- if serializable.
C. If yes then send invalidates to clients with cached copies of written records.
D. If no, abort, discard writes.

(26) What should validation do ?
A. It looks at what the executing transactions read and wrote.
B. Decides if there’s a serial execution order that would have gotten.
C. A and B.
D. None.

Technical Weekly Report

New Cryptography Math

  • We are doing some research to apply to new cryptographic function in Bitconch. Issues here .

  • There are two kinds of algorithm we are proposing, one is used for signature verification, and the other is used to generate and verify the hash of arbitrary size of data.

New Data Structure

  • We are going to apply Conflict Free Replicate Data Type.Replication is a fundamental concept of distributed systems, well studied by the distributed
    algorithms community. Much work focuses on maintaining a global total order of operations even in the presence of faults. Blockchain or Distributed Ledger is a distributed database based on trustless environment. Issues

Technical Weekly Report (Oct 29th ~ Nov 3th)

Work item status

  • Investigate transaction verification in MVP Done

  • Investigate transaction verification in Parity In progress

  • Do a research about EVM Pending

  • Do a research about DAPP Pending

  • Do a research about cpcode, solidity Pending

Replace keccak256 with blake2

Blake2 Intro Slide
Blake2 Introduced by one of the Author
@luhuimao
please do research on Keccak256 Keccak512
under crypto/to/crypto.go, ch, check where they are used, and we are going to replace keccak256/Keccak512 with th blake at golang.org/x/crypto/blake2b

Sample Codes

import (
	"hash"

	"golang.org/x/crypto/blake2b"
)

// NewBlake2b return blake2b-256 hash.
func NewBlake2b() hash.Hash {
	hash, _ := blake2b.New256(nil)
	return hash
}

// Blake2b computes blake2b-256 checksum for given data.
func Blake2b(data ...[]byte) (b32 Bytes32) {
	hash := NewBlake2b()
	for _, b := range data {
		hash.Write(b)
	}
	hash.Sum(b32[:0])
	return
}

Scope

golang src files use sha3.NewKeccak256, total 21 files

#no go file package others
1 C:\Users\Jacky\gopath\src\github.com\Bitconch\BUS\common\types.go
2 C:\Users\Jacky\gopath\src\github.com\Bitconch\BUS\consensus\buffett\buffett.go
3 C:\Users\Jacky\gopath\src\github.com\Bitconch\BUS\consensus\clique\clique.go
4 C:\Users\Jacky\gopath\src\github.com\Bitconch\BUS\consensus\ethash\algorithm.go
5 C:\Users\Jacky\gopath\src\github.com\Bitconch\BUS\core\rawdb\accessors_chain_test.go
6 C:\Users\Jacky\gopath\src\github.com\Bitconch\BUS\core\types\block.go
7 C:\Users\Jacky\gopath\src\github.com\Bitconch\BUS\crypto\crypto.go
8 C:\Users\Jacky\gopath\src\github.com\Bitconch\BUS\eth\downloader\statesync.go
9 C:\Users\Jacky\gopath\src\github.com\Bitconch\BUS\p2p\discv5\net.go
10 C:\Users\Jacky\gopath\src\github.com\Bitconch\BUS\p2p\enr\idscheme.go
11 C:\Users\Jacky\gopath\src\github.com\Bitconch\BUS\p2p\rlpx_test.go
12 C:\Users\Jacky\gopath\src\github.com\Bitconch\BUS\p2p\rlpx.go
13 C:\Users\Jacky\gopath\src\github.com\Bitconch\BUS\p2p\server_test.go
14 C:\Users\Jacky\gopath\src\github.com\Bitconch\BUS\swarm\bmt\bmt_test.go
15 C:\Users\Jacky\gopath\src\github.com\Bitconch\BUS\swarm\bmt\bmt.go
16 C:\Users\Jacky\gopath\src\github.com\Bitconch\BUS\swarm\storage\chunker_test.go
17 C:\Users\Jacky\gopath\src\github.com\Bitconch\BUS\swarm\storage\encryption\encryption_test.go
18 C:\Users\Jacky\gopath\src\github.com\Bitconch\BUS\swarm\storage\hasherstore.go
19 C:\Users\Jacky\gopath\src\github.com\Bitconch\BUS\swarm\storage\types.go
20 C:\Users\Jacky\gopath\src\github.com\Bitconch\BUS\tests\state_test_util.go
21 C:\Users\Jacky\gopath\src\github.com\Bitconch\BUS\trie\hasher.go

golang src files use sha3.NewKeccak512, total 2 files

#no go file package others
1 C:\Users\Jacky\gopath\src\github.com\Bitconch\BUS\consensus\ethash\algorithm.go
2 C:\Users\Jacky\gopath\src\github.com\Bitconch\BUS\crypto\crypto.go

golang src files use crypto.Keccak256, total 42 files

#no go file package others
1 C:\Users\Jacky\gopath\src\github.com\Bitconch\BUS\accounts\abi\abi_test.go accounts
2 C:\Users\Jacky\gopath\src\github.com\Bitconch\BUS\accounts\abi\event.go accounts
3 C:\Users\Jacky\gopath\src\github.com\Bitconch\BUS\accounts\abi\method.go accounts
4 C:\Users\Jacky\gopath\src\github.com\Bitconch\BUS\accounts\keystore\keystore_passphrase.go accounts
5 C:\Users\Jacky\gopath\src\github.com\Bitconch\BUS\accounts\keystore\presale.go accounts
6 C:\Users\Jacky\gopath\src\github.com\Bitconch\BUS\cmd\clef\main.go cmd
7 C:\Users\Jacky\gopath\src\github.com\Bitconch\BUS\cmd\ethkey\utils.go cmd
8 C:\Users\Jacky\gopath\src\github.com\Bitconch\BUS\consensus\buffett\buffett.go consensus
9 C:\Users\Jacky\gopath\src\github.com\Bitconch\BUS\consensus\clique\clique.go consensus
10 C:\Users\Jacky\gopath\src\github.com\Bitconch\BUS\consensus\ethash\algorithm.go consensus
11 C:\Users\Jacky\gopath\src\github.com\Bitconch\BUS\contracts\chequebook\cheque.go contracts
12 C:\Users\Jacky\gopath\src\github.com\Bitconch\BUS\core\bloombits\matcher.go core
13 C:\Users\Jacky\gopath\src\github.com\Bitconch\BUS\core\state\state_object.go core
14 C:\Users\Jacky\gopath\src\github.com\Bitconch\BUS\core\types\bloom9_test.go core
15 C:\Users\Jacky\gopath\src\github.com\Bitconch\BUS\core\types\bloom9.go core core
16 C:\Users\Jacky\gopath\src\github.com\Bitconch\BUS\core\types\transaction_signing.go core
17 C:\Users\Jacky\gopath\src\github.com\Bitconch\BUS\core\vm\contracts.go core
18 C:\Users\Jacky\gopath\src\github.com\Bitconch\BUS\core\vm\instructions.go core
19 C:\Users\Jacky\gopath\src\github.com\Bitconch\BUS\core\vm\runtime\runtime.go core
20 C:\Users\Jacky\gopath\src\github.com\Bitconch\BUS\internal\ethapi\api.go internal
21 C:\Users\Jacky\gopath\src\github.com\Bitconch\BUS\les\handler_test.go les
22 C:\Users\Jacky\gopath\src\github.com\Bitconch\BUS\les\protocol.go les
23 C:\Users\Jacky\gopath\src\github.com\Bitconch\BUS\les\request_test.go les
24 C:\Users\Jacky\gopath\src\github.com\Bitconch\BUS\light\nodeset.go light
25 C:\Users\Jacky\gopath\src\github.com\Bitconch\BUS\light\trie.go light
26 C:\Users\Jacky\gopath\src\github.com\Bitconch\BUS\node\api.go node
27 C:\Users\Jacky\gopath\src\github.com\Bitconch\BUS\p2p\discover\udp.go p2p
28 C:\Users\Jacky\gopath\src\github.com\Bitconch\BUS\p2p\discv5\udp.go p2p
29 C:\Users\Jacky\gopath\src\github.com\Bitconch\BUS\p2p\enr\idscheme.go p2p
30 C:\Users\Jacky\gopath\src\github.com\Bitconch\BUS\p2p\rlpx_test.go p2p
31 C:\Users\Jacky\gopath\src\github.com\Bitconch\BUS\p2p\rlpx.go p2p
32 C:\Users\Jacky\gopath\src\github.com\Bitconch\BUS\signer\core\api.go signer
33 C:\Users\Jacky\gopath\src\github.com\Bitconch\BUS\swarm\network\protocol.go swarm
34 C:\Users\Jacky\gopath\src\github.com\Bitconch\BUS\tests\vm_test_util.go tests
35 C:\Users\Jacky\gopath\src\github.com\Bitconch\BUS\trie\proof_test.go trie
36 C:\Users\Jacky\gopath\src\github.com\Bitconch\BUS\trie\proof.go trie
37 C:\Users\Jacky\gopath\src\github.com\Bitconch\BUS\trie\secure_trie_test.go trie
38 C:\Users\Jacky\gopath\src\github.com\Bitconch\BUS\trie\trie_test.go trie
39 C:\Users\Jacky\gopath\src\github.com\Bitconch\BUS\whisper\whisperv5\envelope.go whisperv5
40 C:\Users\Jacky\gopath\src\github.com\Bitconch\BUS\whisper\whisperv5\message.go whisperv5
41 C:\Users\Jacky\gopath\src\github.com\Bitconch\BUS\whisper\whisperv6\envelope.go whisperv5
42 C:\Users\Jacky\gopath\src\github.com\Bitconch\BUS\whisper\whisperv6\message.go whisperv5

golang src files use crypto.Keccak512, total 1 files

#no go file package others
1 C:\Users\Jacky\gopath\src\github.com\Bitconch\BUS\consensus\ethash\algorithm.go

Changes of go ethereum from v1.8.13 to 1.8.15

Changes for Ethereum 1.8.14

cmd, eth: apply default miner recommit setting
Comments: cmd, eth: apply default miner recommit setting
Changed Files:
cmd/utils/flags.go
eth/config.go

cmd, core, miner: add --txpool.locals and priority mining
Comments:
This PR adds support for specifying local accounts via the CLI flag --txpool.locals (i.e. not requiring an RPC submission to mark something local). This allows nodes to pick up, track and journal local transactions that might have been submitted from a different remote node and arrived via devp2p.
The PR also adds support for prioritizing mining local transactions first and remote ones afterwards. It does it by simply splitting the set of pending transactions into locals and remotes and injecting the locals first, then the remotes.
Changed Files:
cmd/geth/main.go
cmd/geth/usage.go
cmd/utils/flags.go
core/tx_pool.go
miner/worker.go

cmd, eth, miner: make recommit configurable
Comments:
This PR introduces three things:

1.Miner recommit interval now is configurable through --miner.recommit flag
2.Operators can change the interval manually through miner.setRecommitInterval console API in the runtime.
3.Miner recommit interval will be adjusted by system dynamically.
Changed Files:
cmd/geth/main.go
cmd/geth/usage.go
cmd/utils/flags.go
eth/api.go
eth/backend.go
eth/config.go
eth/gen_config.go
internal/web3ext/web3ext.go
les/backend.go
miner/miner.go
miner/worker.go
miner/worker_test.go

miner: fix uncle iteration logic
Comments: Fixed uncle iteration logic in worker.go
Changed Files:
miner/worker.go

consensus/clique, light: light client snapshots on Rinkeby
Comments:
This PR extends the light client to support snapshot syncing on Rinkeby too:
1.Explicitly handle Clique chains by retrieving the epoch block, not the CHT head for a snapshot.
2.Extend Clique so snapshots can be trusted for epoch blocks too (with header), not just genesis.
3.Add the trusted checkpoint for block 2790000 on Rinkeby.
Changed Files:
consensus/clique/clique.go
consensus/clique/snapshot_test.go
light/lightchain.go
light/postprocess.go
params/config.go

vendor: update rjeczalik/notify so that it compiles on Darwin on go1.11
Comments:
update rjeczalik/notify so that it compiles on go1.11
Changed Files:
vendor/github.com/rjeczalik/notify/README.md
vendor/github.com/rjeczalik/notify/appveyor.yml
vendor/github.com/rjeczalik/notify/debug_debug.go
vendor/github.com/rjeczalik/notify/debug_nodebug.go
vendor/github.com/rjeczalik/notify/watcher_fsevents_cgo.go
vendor/github.com/rjeczalik/notify/watcher_fsevents_go1.10.go
vendor/github.com/rjeczalik/notify/watcher_fsevents_go1.11.go
vendor/github.com/rjeczalik/notify/watcher_notimplemented.go
vendor/github.com/rjeczalik/notify/watcher_readdcw.go
vendor/github.com/rjeczalik/notify/watcher_stub.go
vendor/github.com/rjeczalik/notify/watcher_trigger.go
vendor/vendor.json

les: fix CHT field in nodeInfo
Comments:
This PR fixes the empty CHT field of admin.nodeInfo in light server mode
Changed Files:
les/commons.go

eth: upgradedb subcommand was dropped
Comments:
Changed Files:
eth/backend.go

swarm/network: bump bzz protocol version
Comments:
Fixed issue that getting errors after handshake due to nodes not being able to deserialise messages.
Changed Files:
swarm/network/protocol.go
swarm/network/protocol_test.go

swarm, swarm/network, swarm/pss: log error and fix logs
Comments:
This PR is logging an error in case something goes wrong with ListenAndServe, such as trying to listen to a privileged port without necessary privileges, or trying to listen to an already taken port.
It also updates a few logs so that we are a bit more consistent.
Changed Files:
swarm/network/hive.go
swarm/pss/pss.go
swarm/swarm.go

crypto/bn256: add missing license file, release wrapper in BSD-3
Comments: Fixed the issue that missed the LICENSE file while vendoring in the Cloudflare bn256 lib, changes the license of the Cloudflare/Google implementation switcher code from LGPLv3 to BSD-3.
Changed Files:
crypto/bn256/LICENSE
crypto/bn256/bn256_fast.go
crypto/bn256/bn256_fuzz.go
crypto/bn256/bn256_slow.go
crypto/bn256/cloudflare/LICENSE

Ensure from < to when tracing chain
Comments:
Ensure end block come after the start block.
Changed Files:
eth/api_tracer.go

cmd/puppeth: Accept ssh identity in the server string
Comments: allows the user to specify a different SSH identity file for each server and persist it.
Changed Files:
cmd/puppeth/ssh.go
cmd/puppeth/wizard_network.go

light: new CHTs
Comments: New CHTs for mainnet and ropsten
Changed Files:
light/postprocess.go

consensus/ethash: reduce notify test aggressiveness
Comments:
Changed Files:
consensus/ethash/sealer_test.go

travis: remove brew update and osxfuse install
Comments: Remove brew update or brew install osxfuse cause FUSE tests have been disabled on macOS
Changed Files:
.travis.yml

swarm/storage: cleanup task - remove bigger chunks than DefaultSize
Comments:
This PR is updating the swarm db cleanup cmd to remove chunks bigger than our chunk.DefaultSize, which is currently 4KB.
Changed Files:
swarm/storage/ldbstore.go

cmd/swarm: added swarm bootnodes
Comments:
this PR adds the Swarm default bootnodes on startup whenever the CLI bootstrap flag is not specified.
Geth default bootnodes will be ignored in any case, unless explicitly specified by the user on CLI.
Changed Files:
cmd/swarm/bootnodes.go
cmd/swarm/config.go
cmd/swarm/main.go
swarm/api/config.go

miner: update mining log with correct fee calculation
Comments:
change gas usage for miner fee calculation.
Changed Files:
miner/worker.go

les: fix crasher in NodeInfo when running as server
Comments:
moving the indexers, protocol creation and
NodeInfo to a new lesCommons struct which is embedded into both server
and client to fix crasher in NodeInfo when running as server
Changed Files :
les/backend.go
les/commons.go
les/handler.go
les/helper_test.go
les/server.go

build: do not require ethereum-swarm deb when installing ethereum
Comments:
This PR is removing the hack which explicitly added ethereum-swarm as a requirement for ethereum deb package.
Changed Files:
build/ci.go
build/deb/ethereum/deb.control
crypto/bn256/google/bn256.go
crypto/bn256/google/curve.go
crypto/bn256/google/twist.go
vendor/golang.org/x/sys/cpu/cpu.go
vendor/golang.org/x/sys/cpu/cpu_arm.go
vendor/golang.org/x/sys/cpu/cpu_arm64.go
vendor/golang.org/x/sys/cpu/cpu_gc_x86.go
vendor/golang.org/x/sys/cpu/cpu_gccgo.c
vendor/golang.org/x/sys/cpu/cpu_gccgo.go
vendor/golang.org/x/sys/cpu/cpu_mips64x.go
vendor/golang.org/x/sys/cpu/cpu_mipsx.go
vendor/golang.org/x/sys/cpu/cpu_ppc64x.go
vendor/golang.org/x/sys/cpu/cpu_s390x.go
vendor/golang.org/x/sys/cpu/cpu_x86.go
vendor/golang.org/x/sys/cpu/cpu_x86.s
vendor/vendor.json

consensus/ethash: use DAGs for remote mining, generate async
Comments:the many Keccak256 ops can have a significant performance impact if we're doing verification calls non-stop (i.e. a remote miner scenario).
A better approach for remote mining is to use the verification cache initially, but generate the mining DAG in the background and switch over to that. This ensures that remote mining suffers no performance hit, but after the warmup period (1-2 minutes for the DAG generation), it should become a lot faster.
Changed Files:
consensus/ethash/consensus.go
consensus/ethash/ethash.go
consensus/ethash/sealer.go

crypto/bn256: fix issues caused by Go 1.11
Comments:
Changed Files:
crypto/bn256/cloudflare/gfp_amd64.s
crypto/bn256/cloudflare/gfp_decl.go

miner: add gas and fee details to mining logs
Comments:
Changed Files:
miner/worker.go

miner: regenerate mining work every 3 seconds
Comments:
In a more pragmatic approach, we can run a timer within a miner to regenerate the mining block every 3 seconds. That will with a very high probability maximize mining profits, whilst keeping spurious processing down. This PR implements this algorithm.
Changed Files:
core/events.go
miner/worker.go
miner/worker_test.go

cmd/puppeth: fix nil panic on disconnected stats gathering
Comments: The puppeth network stats gathering code currently crashes if it cannot connect to a remote machine due to accessing a field before reconnection is attempted. This PR fixes the access so we only retrieve the IP address if we actually have a connection to retrieve it from.
Changed Files:
cmd/puppeth/wizard_netstats.go

light: CHT and bloom trie indexers working in light mode
Comments:
This PR enables the indexers to work in light client mode by downloading a part of these tries (the Merkle proofs of the last values of the last known section) in order to be able to add new values and recalculate subsequent hashes. It also adds CHT data to NodeInfo.
Changed Files:
core/chain_indexer.go
core/chain_indexer_test.go
eth/backend.go
eth/bloombits.go
les/backend.go
les/distributor.go
les/handler.go
les/helper_test.go
les/odr.go
les/odr_test.go
les/request_test.go
les/retrieve.go
les/server.go
light/lightchain.go
light/odr.go
light/postprocess.go

cmd/swarm, swarm: access control tries
Comments:
introduces access control functionality in Swarm.
Changed Files:
cmd/swarm/access.go
md/swarm/config.go
cmd/swarm/download.go
cmd/swarm/list.go
cmd/swarm/main.go
swarm/api/act.go
swarm/api/api.go
swarm/api/client/client.go
swarm/api/encrypt.go
swarm/api/filesystem.go
swarm/api/http/middleware.go
swarm/api/http/response.go
swarm/api/http/server.go
swarm/api/manifest.go
swarm/api/storage.go
swarm/api/uri.go
swarm/sctx/sctx.go
swarm/swarm.go
swarm/testutil/http.go

miner: streaming uncle blocks
Comments:
includes an optimization for miner to include uncle blocks to mining one as soon as possible.
Changed Files:
miner/worker.go

cmd: polish miner flags, deprecate olds, add upgrade path
Comments:
polishes the miner CLI flags to make them scoped and more consistent with the already polished flags (ethash, txpool, shh). The old flags are deprecated but should still work until we stop supporting them altogether.
Changed Files:
cmd/geth/chaincmd.go
cmd/geth/main.go
cmd/geth/usage.go
cmd/puppeth/module_node.go
cmd/utils/flags.go

backends: increase gaslimit in order to allow tests of large contracts
Comments:
Changed Files:
accounts/abi/bind/backends/simulated.go
contracts/chequebook/gencode.go

miner: move agent logic to worker
Comments:
Remove cpu agent stuff and move all logic to worker
Fix a issue that we should fire ChainEvent only when we insert a canonical block
Push full sealing work only there are some available pending transactions in the txpool
Add some unit tests
Changed Files:
core/blockchain.go
miner/agent.go
miner/miner.go
miner/worker.go

crypto: change formula for create2
Comments:
Changed Files:
core/vm/evm.go
crypto/crypto.go

swarm/network, swarm/storage: validate chunk size
Comments:
1.Adding a check for chunk size when we receive chunks at processReceivedChunks.
2.Extract default chunk size into a new package, because it is used in bmt and in storage and elsewhere.
3.Update Validators that validate the different types of chunks to check for chunk size - content addressed and MRU.
Changed Files:
swarm/bmt/bmt.go
swarm/chunk/chunk.go
swarm/network/stream/delivery.go
swarm/storage/chunker.go
swarm/storage/hasherstore.go
swarm/storage/localstore.go
swarm/storage/mru/handler.go
swarm/storage/mru/update.go
swarm/storage/pyramid.go
swarm/storage/types.go
swarm/swarm.go

cmd, consensus/ethash, eth: miner push notifications
Comments:
this PR introduces a new flag --miner.notify, which accepts a comma-separated list of URLs to push miner work packages to. It's main use case is for mining pools to be pinged by new blocks as fast as possible, without requiring to constantly poll the miner.getWork endpoint.
Changed Files:
cmd/geth/usage.go
cmd/geth/main.go
cmd/utils/flags.go
consensus/ethash/consensus.go
consensus/ethash/ethash.go
consensus/ethash/sealer.go
eth/backend.go
eth/config.go
les/backend.go

Manifest cli fix and upload defaultpath only once
Comments:
This PR enabled the full functionality for manifest add and update commands, even with encrypted uploads, and adds tests for such case.
Changed Files:
cmd/swarm/main.go
cmd/swarm/manifest.go
cmd/swarm/upload.go
swarm/api/api.go
swarm/api/client/client.go
swarm/api/http/server.go
swarm/api/manifest.go

swarm/api/http: added logging to denote request ended
Comments:
addresses a necessary log line that indicates with which status code a request was served
Changed Files:
swarm/api/http/middleware.go
swarm/api/http/response.go

swarm/api: close tar writer in GetDirectoryTar to flush and clean
Comments:
Fixed issue that tar writer in GetDirectoryTar was not closed, that prevented tar writer flush to write zero padding at the end of a response.
Changed Files:
swarm/api/api.go

cmd/swarm: remove shadow err
Comments:
Changed Files:
cmd/swarm/config.go

eth: fix tracer GC which accidentally pruned the metaroot
Comments:
Changed Files:
eth/api_tracer.go
trie/database.go

p2p/discv5: fix idx can be negative after uint convert to int(can cause crash)
Comments:
When data.Idx(topicRegister.Idx) is lower than max uint and higher than max int, it will pass index out of range checking, after the type conversion the Idx may be a negative number and it is used to be an index of array, this may cause a node crash.
Changed Files:
p2p/discv5/net.go

swarm/api/http: fixed list leaf links
Comments:
bzz-list leaf links should point to the actual bzz link, not to another bzz-list address.
Changed Files:
swarm/api/http/templates.go

swarm/bmt: ignore data longer then 4096 bytes in Hasher.Write
Comments:
This PR fixes BMT panic when data longer then 4096 bytes is passed to Hasher.Write method. Currently, we have chunks longer then 4096 bytes on the production cluster and this change will just ignore them on hashing. This PR does not add any support for larger chunks, just tries to fix the panic.
Changed Files:
swarm/bmt/bmt.go

swarm: Added lightnode flag
Comments:
Added a command-line argument and config option to enable Swarm lightnodes.
Changed Files:
cmd/swarm/config.go
cmd/swarm/main.go
swarm/api/config.go
swarm/network/protocol.go
swarm/swarm.go

all: avoid copying arrays in loops
Comments:
Avoid copying arrays of heavy structs (100 bytes and more) in loops. Found by the go-critic linter.
Changed Files:
p2p/discover/table.go
p2p/discv5/table.go
swarm/api/manifest.go
trie/node.go
trie/trie.go

swarm/api/http: http package refactoring
Comments:
addresses a much needed cleanup and refactoring of the swarm http package.
the changeset covers:

  • appropriate methods have been moved into the api package
  • introduces middleware-style routing
  • serves the favicon upon request to /favicon.ico
  • redesign&cleanup of the html responses
  • consolidates all responses under response.go, templates are in templates.go
  • compact responses for curl requests (!) :)
  • introduction of sctx as a way to pass information between components using context objects
    Changed Files:
    swarm/api/api.go
    swarm/api/http/error.go
    swarm/api/http/error_templates.go
    swarm/api/http/middleware.go
    swarm/api/http/response.go
    swarm/api/http/sctx.go
    swarm/api/http/server.go
    swarm/api/http/templates.go
    swarm/sctx/sctx.go

swarm/storage/mru: HOTFIX - fix panic in Handler.update
Comments:
Operator precedence bug causing panic due to rsrc being nil
Changed Files:
swarm/storage/mru/handler.go

p2p: use safe atomic operations when changing connFlags
Comments:
making (c *conn) set really atomic.
Changed Files:
p2p/server.go

rpc: Add admin_addTrustedPeer and admin_removeTrustedPeer.
Comments:
These RPC calls are analogous to Parity's parity_addReservedPeer and
parity_removeReservedPeer.
They are useful for adjusting the trusted peer set during runtime,
without requiring restarting the server.
Changed Files:
internal/web3ext/web3ext.go
node/api.go
p2p/peer.go
p2p/server.go

WIP miner: seperate state, receipts for different mining work
Comments:
Changed Files:
miner/agent.go
miner/worker.go

cmd/puppeth: graceful shutdown on redeploys
Comments:
This PR aims to gracefully shut down puppeth nodes to prevent in-memory caches from being discarded without persisting to disk:

  • Fix termination signal propagation from docker to internal node.
  • Raise the shutdown timeouts to 1 minute to allow slower writes.
    Changed Files:
    cmd/puppeth/module_dashboard.go
    cmd/puppeth/module_ethstats.go
    cmd/puppeth/module_explorer.go
    cmd/puppeth/module_faucet.go
    cmd/puppeth/module_nginx.go
    cmd/puppeth/module_node.go
    cmd/puppeth/module_wallet.go

consensus/ethash: move remote agent logic to ethash internal
Comments:
the remote miner relative logics to ethash engine internally. Since this part of logics are PoW characteristic(including remote miner, hashrate submission or statistic). It can make miner package more clear.
Changed Files:
consensus/clique/clique.go
consensus/consensus.go
consensus/ethash/api.go
consensus/ethash/ethash.go
consensus/ethash/sealer.go
eth/api.go
eth/backend.go
internal/web3ext/web3ext.go
les/backend.go
miner/agent.go
miner/miner.go
miner/remote_agent.go
miner/worker.go

accounts/keystore: rename skipKeyFile to nonKeyFile to better rev…
Comments:
Refactor: rename skipKeyFile to nonKeyFile to better reveal it's purpose to avoid confusion.
Changed Files:
accounts/keystore/file_cache.go

mobile: fix missing return for CallMsg.SetTo(nil)
Comments:
Changed Files:
mobile/ethereum.go

core/vm: update benchmarks for core/vm
Comments:
Update benchmarks to use a pool of int pools.
Unless benchmarks are aborted with segmentation fault.
Changed Files:
core/vm/instructions_test.go

build: explicitly name all packages to be cross-compiled
Comments:
This PR fixes a bug where swarm is not cross-compiled, but we try to archive it into archives for various architectures.
The var that is used to select binaries for cross-compilation is decoupled from the var that selects the binaries for the geth-alltools archive.
Changed Files:
build/ci.go

Linux Interview questions

(1) In Linux bash, the role of the export command is ()
A. Run the command in a subshell.
B. Make command history available in subshells.
C. Set environment variables for other applications.
D. Provide NFS partitions for other systems on the network.

(2) Which of the following parameters can delete a user and delete the user's home directory at the same time? ()
A. rmuser -r
B. deluser -r
C. userdel -r
D. usermgr -r

(3) Running a script, what permissions users don’t need? ()
A. Read.
B. Write.
C. Execute.
D. browse on the directory.

(4) In bash, adding "1>&2" after a command means: ()
A. Standard error output is redirected to standard input.
B. Standard input is redirected to standard error output.
C. Standard output is redirected to standard error output.
D. Standard output is redirected to standard input.

(5) Which of the following commands can copy f1.txt to f2.txt?
A. cp f1.txt | f2.txt
B. cat f1.txt | f2.txt
C. cat f1.txt > f2.txt
D. copy f1.txt | f2.txt

(6) How to quickly switch to user John's home directory?
A. cd @john
B. cd #John
C. cd &John
D. cd ~John

(7) The meaning of the command kill 9 is:
A. kills the process whose PID is 9.
B. kills all processes belonging to UID 9.
C. sends SIGKILL to the process whose PID is 9.
D. sends SIGTERM to the process whose PID IS 9.

(8) How to delete a non-empty subdirectory “/tmp” ?
A. del /tmp/*
B. rm -rf /tmp
C. rm -Ra /tmp/*
D. rm -rf /tmp/*

(9) What does a script file in a Linux system generally start with?
A. $/bin/sh
B. #!/bin/sh
C. use /bin/sh
D. set shell=/bin/sh

(10) What is the command to exit without saving in vi?
A. :q
B. :w
C. :wq
D. :q!

(11) What command is used to detect basic network connections?
A. ping
B. route
C. netstat
D. ifconfig

(12) List all the files in a directory, you need to use the command is?
A. -l
B. ls
C. -a
D. -d

(13) Press the ( ) button to terminate the currently running command
A. Ctrl-C
B. Ctrl-F
C. Ctrl-B
D. Ctrl-D

(14) Which option of the kill command sends the given signal name to the specified process?
A. -l
B. -n
C. -n
D. -a

(15) Which command removes a directory from directory stack?
A. dirs
B. popd
C. pushd
D. rm

(16) Which command puts a script to sleep untill a signal is recieved?
A. sleep
B. suspend
C. disown
D. break

(17) The first line in any shell script begins with a _____
A. &
B. !
C. $
D. #

(18) To run the script, we should make it executable first by using _____
A. chmod +x
B. chmod +r
C. chmod +w
D. chmod +rwx

(19) What are positional parameters?
A. special variables for assigning arguments from the command line
B. pattern matching parameters
C. special variables for reading user input
D. special variables and patterns

(20) The first argument is read by the shell into the parameter ___
A. 1$
B. $3
C. $$
D. $1

(21) The complete set of positional parameters is stored in ______ as a single string.
A. $n
B. $#
C. $*
D. $$

(22) Which of the following is used for storing the number of positional parameters?
A. $n
B. $#
C. $*
D. $2

script to install all dependencies

  • File name

./preset.sh

  • Behaviors
    install all the following depencies:

    1 - clang
    2 - gccgo
    3 - python 3.6++
    4 - rustup
    5 - golang 1.11
    6 - influxdb
    7 - SNAP
    8- libssl-dev

Deploy smart contract locally failed

I was trying to deploy a smart contract locally by truffle, command as below:

truffle migrate

results:

E:\polymath-token-15-1-18_airdrop_script>truffle migrate
Using network 'development'.
Network up to date.

results in ganache-cli prompt:
Listening on 127.0.0.1:8545

net_version
eth_accounts

Expected results if deploy successfully

From the output of my prompt it does't appeared a obvious error , just blocked in somewhere

E:\polymath-token-15-1-18_airdrop_script>node -v
v8.11.4

E:\polymath-token-15-1-18_airdrop_script>truffle version
Truffle v4.1.14 (core: 4.1.14)
Solidity v0.4.24 (solc-js)
'''

Interact with Account's balance

Call process_response to process response from client's request based on response received:
thin_client::ThinClient::process_response(&mut self, resp: &Response)

eg. Request the balance of the user holding 'pubkey':
thin_client::ThinClient::requests_socket.send_to(&data, &self.requests_addr);

Technical Weekly Report (Mar 18th - Mar 31th)

Eventually our first beta release v1.0.0 beta Buffett came out after past months hard-work

  • Buffett v1.0.0 beta released
    A high performance blockchain bitconch that TPS reaching 100K.

Steps to install and start

mkdir go
cd go && mkdir src && cd src && mkdir github.com && cd github.com && mkdir bitconch && cd bitconch
git clone https://github.com/bitconch/bus
cd bus
./preset.sh
./run1.sh

Open 3 other terminals and run following commands

./run2.sh
./run3.sh
./run4.sh

refer to https://github.com/bitconch/bus/releases/tag/1.0.0

  • A web wallet runnning on bitconch
    A feature give away tokens for users

Steps to install and start

npm install

npm run build

npm run start

refer to https://github.com/bitconch/faucet/releases

Summarizes of On Optimistic Methods for Concurrency Control

Summarizes of On Optimistic Methods for Concurrency Control

Disadvantages of locking approch:

  • Lock maintenance represents an overhead that is not present in the sequential
    case. Even read-only transactions (queries), which cannot possibly affect the
    integrity of the data, must, in general, use locking in order to guarantee that
    the data being read are not modified by other transactions at the same time.
    Also, if the locking protocol is not deadlock-free, deadlock detection must be
    considered to be part of lock maintenance overhead.

  • There are no general-purpose deadlock-free locking protocols for databases
    that always provide high concurrency. Because of this, some research has
    been directed at developing special-purpose locking protocols for various
    special cases. For example, in the case of B-trees [l], at least nine locking
    protocols have been proposed [2, 3,9, 10, 131.

  • In the case that large parts of the database are on secondary memory,
    concurrency is significantly lowered whenever it is necessary to leave some
    congested node locked (a congested node is one that is often accessed, e.g.,
    the root of a tree) while waiting for a secondary memory access.

  • To allow a transaction to abort itself when mistakes occur, locks cannot be
    released until the end of the transaction. This may again significantly lower
    concurrency.

  • Most important for the purposes of this paper, locking may be necessary only
    in the worst case. Consider the following simple example: The directed graph
    consists solely of roots, and each transaction involves one root only, any root
    equally likely. Then if there are n roots and two processes executing transactions
    at the same rate, locking is really needed (if at all) every n transactions,
    on the average.

Two cases where highly concurrent access is desirable if we want to maximize the throughput of accesses to the database.

  • The amount of data is sufficiently great that at any given time only a fraction
    of the database can be present in primary memory, so that it is necessary to
    swap parts of the database from secondary memory as needed.
  • Even if the entire database can be present in primary memory, there may be
    multiple processors.

Techinical writings

Create 20 technical articles. And post them on medium/stemmit/hackernoon
Important:
Link github/telegram/facebook/etc at the bottom of these articles.

Topics:
Nature of blockchain's consensus algorithm
How POR will help developers build a social application on the blockchain.
What is Reputation on blockchain?
How does EVM work?
How to build a virtual machine for the smart contract.

Create a minimal EVM

  1. operation codes
Opcode Name Description Extra Info Gas
0x00 STOP Halts execution - 0
0x01 ADD Addition operation - 3
0x02 MUL Multiplication operation - 5
0x03 SUB Subtraction operation - 3
0x04 DIV Integer division operation - 5
0x05 SDIV Signed integer division operation (truncated) - 5
0x06 MOD Modulo remainder operation - 5
0x07 SMOD Signed modulo remainder operation - 5
0x08 ADDMOD Modulo addition operation - 8
0x09 MULMOD Modulo multiplication operation - 8
0x0a EXP Exponential operation - 10*
0x0b SIGNEXTEND Extend length of two's complement signed integer - 5
0x0c - 0x0f Unused Unused -  
0x10 LT Less-than comparison - 3
0x11 GT Greater-than comparison - 3
0x12 SLT Signed less-than comparison - 3
0x13 SGT Signed greater-than comparison - 3
0x14 EQ Equality comparison - 3
0x15 ISZERO Simple not operator - 3
0x16 AND Bitwise AND operation - 3
0x17 OR Bitwise OR operation - 3
0x18 XOR Bitwise XOR operation - 3
0x19 NOT Bitwise NOT operation - 3
0x1a BYTE Retrieve single byte from word - 3
0x20 SHA3 Compute Keccak-256 hash - 30*
0x21 - 0x2f Unused Unused    
0x30 ADDRESS Get address of currently executing account - 2
0x31 BALANCE Get balance of the given account - 400
0x32 ORIGIN Get execution origination address - 2
0x33 CALLER Get caller address - 2
0x34 CALLVALUE Get deposited value by the instruction/transaction responsible for this execution - 2
0x35 CALLDATALOAD Get input data of current environment - 3
0x36 CALLDATASIZE Get size of input data in current environment - 2*
0x37 CALLDATACOPY Copy input data in current environment to memory - 3
0x38 CODESIZE Get size of code running in current environment - 2
0x39 CODECOPY Copy code running in current environment to memory - 3*
0x3a GASPRICE Get price of gas in current environment - 2
0x3b EXTCODESIZE Get size of an account's code - 700
0x3c EXTCODECOPY Copy an account's code to memory - 700*
0x3d RETURNDATASIZE Pushes the size of the return data buffer onto the stack EIP 211 2
0x3e RETURNDATACOPY Copies data from the return data buffer to memory EIP 211 3
0x3f Unused -    
0x40 BLOCKHASH Get the hash of one of the 256 most recent complete blocks - 20
0x41 COINBASE Get the block's beneficiary address - 2
0x42 TIMESTAMP Get the block's timestamp - 2
0x43 NUMBER Get the block's number - 2
0x44 DIFFICULTY Get the block's difficulty - 2
0x45 GASLIMIT Get the block's gas limit - 2
0x46 - 0x4f Unused -    
0x50 POP Remove word from stack - 2
0x51 MLOAD Load word from memory - 3*
0x52 MSTORE Save word to memory - 3*
0x53 MSTORE8 Save byte to memory - 3
0x54 SLOAD Load word from storage - 200
0x55 SSTORE Save word to storage - 20000**
0x56 JUMP Alter the program counter - 8
0x57 JUMPI Conditionally alter the program counter - 10
0x58 GETPC Get the value of the program counter prior to the increment - 2
0x59 MSIZE Get the size of active memory in bytes - 2
0x5a GAS Get the amount of available gas, including the corresponding reduction the amount of available gas - 2
0x5b JUMPDEST Mark a valid destination for jumps - 1
0x5c - 0x5f Unused -    
0x60 PUSH1 Place 1 byte item on stack - 3
0x61 PUSH2 Place 2-byte item on stack - 3
0x62 PUSH3 Place 3-byte item on stack - 3
0x63 PUSH4 Place 4-byte item on stack - 3
0x64 PUSH5 Place 5-byte item on stack - 3
0x65 PUSH6 Place 6-byte item on stack - 3
0x66 PUSH7 Place 7-byte item on stack - 3
0x67 PUSH8 Place 8-byte item on stack - 3
0x68 PUSH9 Place 9-byte item on stack - 3
0x69 PUSH10 Place 10-byte item on stack - 3
0x6a PUSH11 Place 11-byte item on stack - 3
0x6b PUSH12 Place 12-byte item on stack - 3
0x6c PUSH13 Place 13-byte item on stack - 3
0x6d PUSH14 Place 14-byte item on stack - 3
0x6e PUSH15 Place 15-byte item on stack - 3
0x6f PUSH16 Place 16-byte item on stack - 3
0x70 PUSH17 Place 17-byte item on stack - 3
0x71 PUSH18 Place 18-byte item on stack - 3
0x72 PUSH19 Place 19-byte item on stack - 3
0x73 PUSH20 Place 20-byte item on stack - 3
0x74 PUSH21 Place 21-byte item on stack - 3
0x75 PUSH22 Place 22-byte item on stack - 3
0x76 PUSH23 Place 23-byte item on stack - 3
0x77 PUSH24 Place 24-byte item on stack - 3
0x78 PUSH25 Place 25-byte item on stack - 3
0x79 PUSH26 Place 26-byte item on stack - 3
0x7a PUSH27 Place 27-byte item on stack - 3
0x7b PUSH28 Place 28-byte item on stack - 3
0x7c PUSH29 Place 29-byte item on stack - 3
0x7d PUSH30 Place 30-byte item on stack - 3
0x7e PUSH31 Place 31-byte item on stack - 3
0x7f PUSH32 Place 32-byte (full word) item on stack - 3
0x80 DUP1 Duplicate 1st stack item - 3
0x81 DUP2 Duplicate 2nd stack item - 3
0x82 DUP3 Duplicate 3rd stack item - 3
0x83 DUP4 Duplicate 4th stack item - 3
0x84 DUP5 Duplicate 5th stack item - 3
0x85 DUP6 Duplicate 6th stack item - 3
0x86 DUP7 Duplicate 7th stack item - 3
0x87 DUP8 Duplicate 8th stack item - 3
0x88 DUP9 Duplicate 9th stack item - 3
0x89 DUP10 Duplicate 10th stack item - 3
0x8a DUP11 Duplicate 11th stack item - 3
0x8b DUP12 Duplicate 12th stack item - 3
0x8c DUP13 Duplicate 13th stack item - 3
0x8d DUP14 Duplicate 14th stack item - 3
0x8e DUP15 Duplicate 15th stack item - 3
0x8f DUP16 Duplicate 16th stack item - 3
0x90 SWAP1 Exchange 1st and 2nd stack items - 3
0x91 SWAP2 Exchange 1st and 3rd stack items - 3
0x92 SWAP3 Exchange 1st and 4th stack items - 3
0x93 SWAP4 Exchange 1st and 5th stack items - 3
0x94 SWAP5 Exchange 1st and 6th stack items - 3
0x95 SWAP6 Exchange 1st and 7th stack items - 3
0x96 SWAP7 Exchange 1st and 8th stack items - 3
0x97 SWAP8 Exchange 1st and 9th stack items - 3
0x98 SWAP9 Exchange 1st and 10th stack items - 3
0x99 SWAP10 Exchange 1st and 11th stack items - 3
0x9a SWAP11 Exchange 1st and 12th stack items - 3
0x9b SWAP12 Exchange 1st and 13th stack items - 3
0x9c SWAP13 Exchange 1st and 14th stack items - 3
0x9d SWAP14 Exchange 1st and 15th stack items - 3
0x9e SWAP15 Exchange 1st and 16th stack items - 3
0x9f SWAP16 Exchange 1st and 17th stack items - 3
0xa0 LOG0 Append log record with no topics - 375
0xa1 LOG1 Append log record with one topic - 750
0xa2 LOG2 Append log record with two topics - 1125
0xa3 LOG3 Append log record with three topics - 1500
0xa4 LOG4 Append log record with four topics - 1875
0xa5 - 0xaf Unused -    
0xb0 JUMPTO Tentative libevmasm has different numbers EIP 615  
0xb1 JUMPIF Tentative EIP 615  
0xb2 JUMPSUB Tentative EIP 615  
0xb4 JUMPSUBV Tentative EIP 615  
0xb5 BEGINSUB Tentative EIP 615  
0xb6 BEGINDATA Tentative EIP 615  
0xb8 RETURNSUB Tentative EIP 615  
0xb9 PUTLOCAL Tentative EIP 615  
0xba GETLOCAL Tentative EIP 615  
0xbb - 0xe0 Unused -    
0xe1 SLOADBYTES Only referenced in pyethereum - -
0xe2 SSTOREBYTES Only referenced in pyethereum - -
0xe3 SSIZE Only referenced in pyethereum - -
0xe4 - 0xef Unused -    
0xf0 CREATE Create a new account with associated code - 32000
0xf1 CALL Message-call into an account - Complicated
0xf2 CALLCODE Message-call into this account with alternative account's code - Complicated
0xf3 RETURN Halt execution returning output data - 0
0xf4 DELEGATECALL Message-call into this account with an alternative account's code, but persisting into this account with an alternative account's code - Complicated
0xf5 CALLBLACKBOX - -  
0xf6 - 0xf9 Unused - -  
0xfa STATICCALL Similar to CALL, but does not modify state - 40
0xfb CREATE2 Create a new account and set creation address to sha3(sender + sha3(init code)) % 2**160 -  
0xfc TXEXECGAS Not in yellow paper FIXME - -
0xfd REVERT Stop execution and revert state changes, without consuming all provided gas and providing a reason - 0
0xfe INVALID Designated invalid instruction - 0
0xff SELFDESTRUCT Halt execution and register account for later deletion - 5000*

Technical Weekly Report (Feb 4th - Feb 14th)

pre-testnet-release
You can check the codes from this url: https://github.com/bitconch/bus/releases
This is the pre test net release, we have create several tools to implement the bitconch whitepaper.

  1. Configuration tools under cmd folder
  2. Genesis tools under cmd folder
  3. Fullnode and its configuration tools under cmd folder
  4. Scripts to setup env, precompile, compile and build.
  5. You can go to release tab on github code, download the source codes and try to test the code yourself.

Current and next step
A fully functional wallet cli, facuet, block explore, and lot more. Which will be released very soon.

Windows Powers-shell Interview questions

(1) What does the powershell command “Test-Path c:\PowerShell.xlsx” means ()
A. Executing “c:\PowerShell.xlsx”.
B. Open file “c:\PowerShell.xlsx”.
C. Delete file “c:\PowerShell.xlsx”.
D. Check file “c:\PowerShell.xlsx” exist or not.

(2) How to move a file to other place in powershell?
A. Move c:\PowerShell.xlsx d:\PowerShell.xlsx.
B. mv c:\PowerShell.xlsx d:\PowerShell.xlsx.
C. copy c:\PowerShell.xlsx d:\PowerShell.xlsx.
D. Move-Item c:\PowerShell.xlsx d:\PowerShell.xlsx.

(3) How to open a executable file in powershell?
A. run c:\Windows\System32\notepad.exe
B. open c:\Windows\System32\notepad.exe
C. execute c:\Windows\System32\notepad.exe
D. Invoke-Item c:\Windows\System32\notepad.exe

(4) How to output the current time in command promt ?
A. print time.
B. print date.
C. echo %time%
D. echo %date%

(5) How to executing multiple commands in one command line in batch file?
A. command1 : command2 : command3: …
B. command1 & command2 & command3& …
C. command1 @ command2 @ command3@ …
D. command1 ! command2 !: command3!: …

(6) How to call a batch file?
A. Run a.bat
B. Invoke a.bat
C. Execute a.bat
D. Call a.bat

(7) The result of the following command is ()
@echo off
set /a num1=20
set /a num2=15
if %num1% gtr %num2% echo %num1%greater%num2%
if %num1% EQU %num2% echo %num1%equal%num2%
if %num1% LSS %num2% echo %num1%less%num2%
A. 20 greater 15
B. 20 less 15
C. 20 equal 15
D. 20

(8) What is Powershell Scripting?
A. Type the commands in a text editor
B. Save the file with .ps1 extension
C. Execute the file in PowerSehll
D. All of these

(9) What are the types of format commands that can be used to Format data?
A. Format-Wide
B. Format-List
C. Format-Table
D. All of the above

(10) What are the types of brackets used in PowerShell?
A. Parenthesis Brackets ()
B. Braces Brackets {}
C. Square Brackets []
D. All of the above mentioned

(11) What are the ways to find all the sql services are on one server in PowerShell?
A. get-wmiobject win32_service l where-object {$_name-like “sql”}
B. get-service sql
C. Both A and B
D. None

(12) How do you find the computer name in PowerShell ?
A. hostname
B. $env:COMPUTERNAME
C. Get-ItemProperty -Path “HKLM:SYSTEMCurrentControlSetControlComputerNameActiveComputerName” -Name “ComputerName” | Select-Object -Property Computername
D. All of them

(13) How do you find the free space of C: drive in GBs?
A. Get-PSDrive –Name C | ForEach-Object {[math]::round($.free/1GB)}
B. Get-PSDrive –Name C | % {[math]::round($.free/1GB)}
C. Get-PSDrive –Name C | Select-Object -Property free | % {[math]::round($_.free/1GB)}
D. All of them

(14) How to find top 100 processes that are consuming memory more than 100MB and export the list of processes to a CSV file?
A. Get-Process | where pm -gt 100MB | select -First 100 | Sort pm -Descending | Export-Csv C:TempProcess-100MB-Memmory.csv
B. Get-Process | where pm -gt 100MB | select -First 100 | Sort pm -Descending
C. A and B
D. None

(15) How do you measure the time taken for execution of a PowerShell command?
A. Measure-Command { Get-WmiObject -Class win32_service | where-object { ($.StartMode -eq “Manual”) -and ($.State -eq “Running”) } } | select TotalSeconds | ft -a
B. Measure-Command { Get-WmiObject -Class win32_service -Filter “StartMode=’Manual’ and State=’Running'” } | Select TotalSeconds | ft -a
C. A and B
D. None

cdylib: Clap not accepting arguments on Ubuntu (still works on Windows10)

codes in cdlylib is an sample to test cross calling of rust/go

System information

bus version: pre mainnet launch
OS & Version:
Windows 10 /Ubuntu 18.04
Commit hash :09126b14cd401e3e07053a3a97f8facc90ec8112
hardware :

Expected behaviour

run main -xiudre, should print

Hello Hello Dummy!
This is a simple CLI created by Clap
error: Found argument '-s' which wasn't expected, or isn't valid in this context

USAGE:
    main.exe [OPTIONS]

For more information try --help

Actual behaviour

on Windows10 works,
on Ubuntu 18.04, print nothing

Steps to reproduce the behaviour

cd cdylib

python build.py

cd lib

main -xurhfe

Backtrace

[backtrace]

title: 'cdylib: Clap not accepting argument on Ubuntu (still works on Windows10)'
labels: bug
assignees: caesarchad,ben

Apply Conflict-Free Replicate Data Type

In distributed computing, a conflict-free replicated data type (CRDT) is a data structure which can be replicated across multiple computers in a network, where the replicas can be updated independently and concurrently without coordination between the replicas, and where it is always mathematically possible to resolve inconsistencies which might result.
The CRDT concept was formally defined in 2011 by Marc Shapiro, Nuno Preguiça, Carlos Baquero and Marek Zawirski. Development was initially motivated by collaborative text editing and mobile computing.

MVP Test environment preparation

Test Env Preparation

host 1

1 - Download all the files from /testchain/.. on master branch
2 - Download the geth from /cmd/geth/
3 - Start node00

host 2

1 - Download all the files from /testchain/.. on master branch
2 - Download the geth from /cmd/geth/
3 - Start node01
4 - Add peer node
5 - modifty the app.json file
6 - nmp start
7 - navigate to localhost:8000 to see the block explorer.

Technical Weekly Report (Dec 17th - Dec 30th)

For the past fifteen days We :

  1. Implement the Conflict Reputation Data Type module achieve the following functionalities:
  • Maintain peer info(eg. Create New peer by a UDP address , public key)
  • Broadcast messages from one node to the rest nodes
  • Process vote messages
  1. Implement streamer module to achieve the following functionalities:
  • Efficiently receive && send data through UDP sockets.
  1. We're Implement functionality to processing incoming transactions in a multiple stages pipeline

Summarize errors occurred during package compilation

  • cannot use "github.com/pborman/uuid".NewRandom() (type "github.com/pborman/uuid".UUID) as type "github.com/ethereum/go-ethereum/vendor/github.com/pborman/uuid".UUID in field value

Hit this kind of error means there is same package name in different places that will make the compiler confused.
To solve this problem just need to rename the package one of them.

Golang interview questions

(1) Keyword in golang()
A. func
B. def
C. struct
D. class

(2) How to define a global string variable ()
A. var str string
B. str := ""
C. str = ""
D. var str = ""

(3) How to access pointer p’s member variable: “name”()
A. p.name
B. (*p).name
C. (&p).name
D. p->name

(4) Regarding the interface and class, which statement is correct in the following options ()
A. A class only needs to implement all the functions required by the interface, we say that this class implements the interface.
B. When implementing a class, you only need to care about which methods you should provide, and you don’t have to worry about the interface.
C. When the class implements the interface, you need to import the package where the interface is located.
D. The interface is defined by the user according to their own needs, and the user does not need to care whether other modules have defined similar interfaces.

(5) Regarding string connection, which syntax is correct in the following options ()
A. str := ‘abc’ + ‘123’
B. str := "abc" + "123"
C. str := '123' + "abc"
D. fmt.Sprintf("abc%d", 123)

(6) Regarding the goroutine, which statement is correct in the following options ()
A. Both the goroutine and the thread can implement concurrent execution of the program.
B. Threads are lighter than goroutines.
C. There is no deadlock problem in goroutine.
D. goroutine communication via channel.

(7) Regarding the init function, which statement is correct in the following options ()
A. package can contain multiple init functions.
B. When the program is compiled, the init function of the import package is first executed, and then execute the init function in this package.
C. In the main package, there can be no init function.
D. Init function can be called by other functions.

(8) Regarding the loop statement, which statement is correct in the following options ().
A. Loop statements support both the “for” keyword and the “while” and “do-while”.
B. There is no difference between the basic usage of the keyword for and C/C++.
C. The “for” loop supports “continue” and “break” to control the loop, but it provides a more advanced break, which loop can be selected to break.
D. The “for” loop does not support multiple assignment statements separated by commas. You must initialize multiple variables using parallel assignment.

(9) For function definitions:
func add(args ...int) int {
sum :=0
for _,arg := range args {
sum += arg
}
returnsum
}
which statement is correct in the following options for the add function call ()
A. add(1, 2)
B. add(1, 3, 7)
C. add([]int{1, 2})
D. add([]int{1, 3, 7}...)

(10) Regarding type conversion, which is correct in the following options ()
A. type MyInt int
var i int = 1
var jMyInt = i
B. type MyIntint
var i int= 1
var jMyInt = (MyInt)i
C. type MyIntint
var i int= 1
var jMyInt = MyInt(i)
D. type MyIntint
var i int= 1
var jMyInt = i.(MyInt)

(11) Regarding the initialization of local variables, which is the correct way to use in the following options ()
A. var i int = 10
B. var i = 10
C. i := 10
D. i = 10

(12) Regarding the const constant definition, which is the correct way to use in the following options ()
A. const Pi float64 = 3.14159265358979323846
const zero= 0.0
B. const (
size int64= 1024
eof = -1
)
C. const (
ERR_ELEM_EXISTerror = errors.New("element already exists")
ERR_ELEM_NT_EXISTerror = errors.New("element not exists")
)
D. const u, vfloat32 = 0, 3
const a,b, c = 3, 4, "foo"

(13) Regarding the assignment of the Boolean variable b, which usage is incorrect in the following options ()
A. b = true
B. b = 1
C. b = bool(1)
D. b = (1 == 2)

(14) The result of the following program is ()
func main() {
if (true) {
defer fmt.Printf("1")
} else {
defer fmt.Printf("2")
}
fmt.Printf("3")
}
A. 321
B. 32
C. 31
D. 13

(15) Regarding the switch statement, the following statement is correct ()
A. Conditional expressions must be constants or integers.
B. Multiple result options can appear in a single case.
C. Need to use “break” to explicitly exit a case.
D. Only if the “fallthrough” keyword is explicitly added in the case then the next case will be executed.

(16) There is no hidden “this” pointer in golang, the meaning of this sentence is ()
A. The object applied by the method is explicitly passed, not hidden.
B. Golang follows many traditional concepts in object programming, such as inheritance, virtual functions, and constructors.
C. The object-oriented expression of golang is more intuitive, and the process-oriented process is just another grammatical form.
D. The object applied by the method does not need to be a pointer, nor does it have to be called “this”.

(17) Reference types in golang include ()
A. Array slice
B. map
C. channel
D. interface

(18) Pointer operations in golang include ()
A. Can increment or decrement the pointer.
B. The address of the pointer can be taken by "&".
C. The data pointed to by the pointer can be taken by "*".
D. Can perform subscript operations on a pointer.

(19) Regarding the main function (the starting point of a executable program), which statement is correct in the following options ()
A. The main function cannot take any parameters.
B. The main function cannot define a return value.
C. The package where the main function is located must be the main package.
D. The main function can use the flag package to get and parse command line arguments.

(20) The correct assignment below is ()
A. var x = nil
B. var x interface{} = nil
C. var x string = nil
D. var x error = nil

Mvp workflow and core modules functionality

NCP: Implement the network control plane.

RPU: Implements the Request Processing Unit, It listens for Request messages from clients and replies with Response messages.

TPU: Implements the Transaction Processing Unit.

TVU: Implements the Transaction Validation Unit

TPS improvement: Database

Replace leveldb with more powerful key value store DB:
candidate: foundtionDB, badgerDB, and others?

Why we need an EVM

EVM Requirements
● Small code size (so that very many contracts from many users can be stored by one node)

● VM security designed around running untrusted code from arbitrary parties
each of these features implies big security issues. think of it, you can write a code which ping (of death) another machine or access protected files or even steal the miner's private keys. Even sandboxed a flaw could occur and file "write/read" feature could break the whole system's security. so we'll need to get rid of all these features, which is a hard task to achieve for a licensed VM. We need to remember that a Blockchain VM should be isolated whitout the capacity to communicate with the external environement.

● Multiple implementations (for cross-checking, and to mitigate developer centralization in the public chain)

● Perfect determinism (for consensus)

● Infinite loop resistance

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.