EOS - Developer’s Log Stardate 20176.30

in #eos7 years ago

This week block.one’s blockchain c++ development team has picked up 4 new members and has been interviewing a few more. The new recruits have already begun making contributions to the code.

Removing Registered Message Schemas

With the move to WebAssembly (WASM) we have had to re-evaluate some of our earlier design decisions based on the assumption of using Wren. Because WASM is language independent, every application would have to provide different WASM for parsing the messages passed to the application. This means the ABI (application binary interface) is technically defined by the WASM parsing and not our prior builtin registered message types and formats.

Since the blockchain is unable to enforce the message schemas and every contract would have to independently parse and validate the incoming binary data, we opted to remove the blockchain defined message schemas. This gives more power to application developers.

Changing Account Name Structure

One of the bigger changes to the code this week was changing account names from 256 bit strings to 60 bit integers that convert to human-readable names via base32 encoding. This limits the account names to 12 lowercase letters and a few numbers. The average Twitter account is only 12 characters long.

This change was made primarily out of bandwidth, memory, and performance considerations. From an applications logic perspective an account name is simply a unique identifier and they are used everywhere. The old ABI would serialize these account names as length-prefixed strings and require a computationally intensive unpacking process.

By moving to a fixed-width integer representation for accounts we got performance, but the developer experience was less friendly. To resolve this we simply print the integers as base32 and this gives human-readable names.

Longer names can still be supported by registering them with a name service contract.

A typical transfer message is 75% smaller after this change, which makes a big difference when you are processing 10's of thousands of them per second.

Filtering Floating point from WASM

We updated the WASM processing to detect and reject code that uses floating point operations which can generate non-deterministic behavior.

Sandboxing WASM Runtime

We made significant progress toward injecting checkpoints into WASM to allow us to check the runtime and abort if too much time has passed. This is a critical component of running untrusted code.

New C++ Simplecoin (80,000 TPS)

In one of my prior updates I showed a proof-of-concept currency smart contract written in C and achieving 50K transactions per second. I mentioned that I thought we could clean up the syntax and today I am happy to show a new implementation of the simplecoin in C++ that gets compiled to WASM and then executed. Using a tight loop of generating and pushing transactions to the blockchain we achieved 80K TPS transferring funds from one account to another in a single thread.

Real world performance may be higher or lower based upon the evolving architecture, it is still too early to tell. All measurements were made on a 4Ghz Intel Core i7 in a 2014 iMac.

struct Transfer {
  uint64_t    from;
  uint64_t    to;
  uint64_t    amount;
  char        memo[];
};
 
static_assert( sizeof(Transfer) == 3*sizeof(uint64_t), "unexpected padding" );
 
struct Balance {  uint64_t    balance; };
 
void on_init() {
  static Balance initial = { 1000*1000 };
  static AccountName simplecoin;
  simplecoin = name_to_int64( "simplecoin" );
 
  store( simplecoin, initial ); 
}
 
void apply_simplecoin_transfer() {
   static Transfer message;
   static Balance from_balance;
   static Balance to_balance;
   to_balance.balance = 0;
 
   readMessage( message  );
   load( message.from, from_balance );
   load( message.to, to_balance );
 
   assert( from_balance.balance >= message.amount, "insufficient funds" );
   
   from_balance.balance -= message.amount;
   to_balance.balance   += message.amount;
   
   if( from_balance.balance )
      store( message.from, from_balance );
   else
      remove( message.from );
 
   store( message.to, to_balance );
}

Not only is the code cleaner and easier to read, the generated WASM code is much smaller too. Most of this time and space savings is made possible by changing the account name and ABI for this contract. In this case the ABI uses a zero-parse copy from the database to the c++ struct and all account names are fixed length.

You can experiment with this code on WasmFiddle with this shared link.

Conclusion

The EOS development team is growing and the technology is progressing with all signs pointing toward a very high-performance platform even running in a single thread. Stay tuned for more updates!

Sort:  

Thanks for using my image. : )

Nice to see these notes and a EOS POC.

Good job.

Nice post! What will happening, if someone resteem your post?

Report from bytemaster himself, just like good old days :) I would be great if payout wasn't declined.

My understanding of how EOS achieves massive transaction speed / scalability is that it delegates block production to a single actor for each block. How is block forgery NOT possibly a problem? I've read the explanations and it's somehow 'the longest chain wins' like Bitcoin ... but I don't see how that actually applies in a 'one actor per block' scheme? One actor just forges, block is hashed, boom, done: nobody the wiser. Hope my question makes sense :) and I'd love to know the answer! Big fan of EOS in all other ways than this lingering doubt.

Bitcoin works same way, one actor per block. Bitcoin uses hash and pow for signature which can be forged by anyone willing to spend as much pow, DPOS uses private key signatures which cannot be forged without hacking an account.

That's great informative comment.

So with all these layers of security it is still not safe from the threat of a hacker ? Now I totally feel safe with the $20,000 I just put into this project :(

Well, I guess you best leave it in your bank account or bitcoin wallet which are both also vulnerable to having their accounts "hacked".

Username checks out.

I'm glad to hear that with the increase in technology and performance, the safety is even more important.

dan why this Payout decline of ur post?

In an era of permissioned blockchains gaining favor with financial institutions over decentralized, freely trading cryptocurrencies like Bitcoin, Ethereum, or Ripple, Safe Cash is one of the first blockchains to be commercially viable that can meet the transaction processing speed and throughput requirements of today's market. Safe Cash employs instant settlement in under five seconds, improved security, and controlled consensus that does not rely on miners or any intermediary coin that must be purchased. It allows banks to wean themselves off the high-priced, inefficient SWIFT network that can take days to transfer money. Banks can have their own "white label" blockchain that they control and manage. Inter-bank settlement can be achieved with multi-currency wallets, a separate bank settlement blockchain, or a combination thereof, depending on bank requirements and legal compliance.

I CAN'T STOP SAYING ABOUT THIS FILMS _ _ YOU SHOULD WATCH THEM _ _BEST ON YOUTUBE
I WANT THIS FILM BE POPULAR. DON'T LOWER ME CARMA. ONLY WATCH on YOUTUBE.
https://steemit.com/neill/@uneducated/new-best-films-on-youtube-firebase-and-rakka-donate-them-if-you-like25-reasons-why-you-should-come-to-america-020111-33-728.jpg

Achieving 80K Transactions Per Second would be truly incredible, i guess EOS will be the fastest among all crypto-currencies. Congratulations and warm welcome to all the new EOS developers .

Bitshares already does 100k transactions per second.

For now enjoy bitshares and steem. Still the fastest in crypto land.

If they can pull it off, it will be the fastest without a doubt, c++ and "c" are machine level coding languages basically, the closer you get to machine level, faster the data transmission because gpu's are hardware so no need for conversion after a hash hack. I truly applaud them on trying.

Don't know man. With today's operating systems, you really never code at hardware / machine level anymore. Back in the DOS / Win 3.1 era you could make a C program talk directly with the parallel port.
When newer OS arrived, those same programs would crash as they no longer had permission to talk directly with the hardware, needing to go through the OS API instead. There is always some layers. Unless you are making your own OS or using some tough guy Linux distro.

Is the 100K per second what they are saying they will achieve or has this technology already been put in place ? I heard some people quoting 1 million per second

This could easily become the best crypto currency to be ever made if everything succeeded. 80,000 tx per second is going to be incredible. Looking forward to it's development.

This is going to be interesting. Very interesting - hope you keep up the log over the next 12 months and look forward to reading your updates!

Me too hopefully there is a positive result some where along the lines of bitshares. Just bought 50 ether work and hoping for the best

Slow and steady win the game.

Great update and very good news, what a potent crew in the making. This is awesome! All for one and one for all!!! Namaste :)

Very interesting, thank you!

Hey Dan!!! I came by to learn some more and say have a good weekend.

You must be stoked about the Poloniex news I broke on my page today about 10 mins after they finally released the stranglehold on everyone's BTS wallets for like 100 years slight hyperbole ---- they still cannot find the 500 SBD I transferred to them a week ago and I cannot reach them.


Like with BTS, I am still telling people to check it out, sending people over -- I am still learning.

It is our Canadastan Day long weekend here like your Almost Independence Day there coming up.... I wish you the best always, some rest and fun and stay strong man.

I am always rooting for you!!!

BarryDutton Barry Dutton tweeted @ 01 Jul 2017 - 01:23 UTC

Brand new $EOS #EOS update. @EOS_io @bytemaster7 #CryptoCurrency #Blockchain

steemit.com/eos/@dan/eos-d… / https://t.co/9d4rjSpKmI

Disclaimer: I am just a bot trying to be helpful.

Coin Marketplace

STEEM 0.17
TRX 0.16
JST 0.028
BTC 76556.14
ETH 2925.60
USDT 1.00
SBD 2.61