Author Topic: [Worker Proposal] On-chain smart contracts for Bitshares  (Read 9229 times)

0 Members and 1 Guest are viewing this topic.

Offline bitcrab

  • Committee member
  • Hero Member
  • *
  • Posts: 1928
    • View Profile
  • BitShares: bitcrab
  • GitHub: bitcrab
up to now I don't think it's a good idea to make Bitshares a smart contract platform.

one big concern is security, yes smart contract can bring great flexibility, but it also bring risk, we have seen many security events that had happened in Ethereum&EOS, Bitshares is a system focus on Finance, we should be more careful while handling this topic.

yes smart contract is a trend for public blockchain, but that does not means each public chain should become a smart contract platform, smart contract is a big new feature and is not so tightly linked to Bitshares' current competitiveness.   
Email:bitcrab@qq.com

Offline yury

  • Jr. Member
  • **
  • Posts: 42
    • View Profile
    • openledger.info
I would like to hear more about how BitShares can benefit from connecting to the EVM.  What sort of DAPPs do you think can be facilitated on the BTS blockchain with this development?
Valid question, John! I have mentioned some of them in my original post, but generally speaking, there may be any of them - just look at Ethereum and EOS, any of smart contract that is available there can be implemented on Bitshares when the solution is active. Considering that Bitshares already have DEX and stable coins, building DApps on top of it may be more reasonable than using Ethereum or EOS. Low fees and fast operation are another reasons to select Bitshares for your business app.

Ultimately I can see this as being a way to reinvigorate the perception of BitShares.  If you're reading this you are likely aware of the vast capability of the BTS blockchain.  However, it has become abundantly clear that the term 'smart contract' itself has a social currency all of its own and getting exposure to that may be rewarding for stakeholders.
This is totally inline with our vision. This solution is intended to expand adoption of Bitshares, attract more businesses and users, allow stakeholders to benefit.
Yury Cherniawsky
OpenLedger

Offline yury

  • Jr. Member
  • **
  • Posts: 42
    • View Profile
    • openledger.info

I tend to think BitShares needs to A) define target audiences and B) list the features and functionality (in priority order) required for each audience identified, including completed, in development and what's next. Yes, that's marketing, but unless we can all point to a document or source that embodies these things BitShares will bounce from one pinball bumper to the next in reaction to the community concern of the day. We won't be focused and progress will be what it is now.

How does the upcoming HTLC functionality affect this discussion? Will you utilize HTLC to accomplish this?

Thanks a lot for your interest, Thom! I would like to highlight, this solution is not about an interface from Bitshares to any other blockchain (like Ether or EOS), this is Bitshares core update that allows to run custom smart contracts inside Bitshares blockchain. I do agree every blockchain shall has it target audience and designation, but as the technology evolves, some of the functionality is becoming mandatory for a decent ecosystem. I see no reason for Bitshares stay away from the progress just because other networks have custom smart contracts already implemented. Bitshares needs this feature as well. HTLC is another nice feature to have, but has no direct connection to the proposed solution. 
Yury Cherniawsky
OpenLedger

Offline pc

  • Hero Member
  • *****
  • Posts: 1530
    • View Profile
    • Bitcoin - Perspektive oder Risiko?
  • BitShares: cyrano
Thanks, Yury! An interesting proposal.

Is it correct that script execution is exclusively triggered by call_contract operation? I. e. it is not possible to have scripts triggered by e. g. incoming payment, order execution, market price changes, block time, etc.? That would make things much more controllable wrt time spent on contract execution per block, but would also severely limit the usefulness.

All "write access" to chain state happens exclusively through normal operations, correct? How is authentication / authorization handled there? Do you support bundling operations into all-or-nothing transactions?

Do these contract-generated operations end up in the blocks? That would open up the possibility that the VM is implemented as a plugin that is mandatory only for witnesses.

What happens when a call_contract operation is rolled back, e. g. if it was part of a transaction with a subsequent operation that failed? Is the GAS fee also paid in that case?

Since BitShares is operating with very tight timing constraints, is it possible to limit the total amount of GAS spent per block? IMO committee-defined fees / GAS price is not capable of reacting quickly enough. An alternative might be to let the committee define a minimum GAS price and a maximum amount of GAS per block, and "auction off" the available GAS per block to the pending call_contract operations.
Bitcoin - Perspektive oder Risiko? ISBN 978-3-8442-6568-2 http://bitcoin.quisquis.de

Offline JohnR

  • Committee member
  • Full Member
  • *
  • Posts: 96
    • View Profile
I take a broad view of 'smart contract' as any predefined digital agreement that executes autonomously without the need for an intermediary or other third party (besides an oracle).  BitShares has smart contracts of a very limited functionality - bitUSD/bitCNY.  These operate without the need for any agent to take action and serve an important role in financial services in a distributed environment.

This proposal deals with integrating general purpose operations (as opposed to specific financial contracts above) also known as "turing completeness".  Of course I welcome any time and effort being put into expanding the capability of the BitShares network.  Especially coming from one of the most respected firms operating on the chain. I would like to hear more about how BitShares can benefit from connecting to the EVM.  What sort of DAPPs do you think can be facilitated on the BTS blockchain with this development?

Ultimately I can see this as being a way to reinvigorate the perception of BitShares.  If you're reading this you are likely aware of the vast capability of the BTS blockchain.  However, it has become abundantly clear that the term 'smart contract' itself has a social currency all of its own and getting exposure to that may be rewarding for stakeholders.
« Last Edit: October 13, 2018, 02:09:59 am by JohnR »

Offline Thom

You go Yuri! Well written OP!!

I can see OL has invested a significant amount of time and effort supporting Etherium tokens and this is a logical extension if that effort.

Although I do agree that EOS is in too early a state of evolution for stability and broad consensus (the EOS community is very diverse and many in that community operate under opposing principles and visions of what they want the platform to become), my view is like your #1, and BitShares shouldn't be trying to be all things to all people or businesses. Lets let EOS evolve and if it moves in a direction favorable to BitShares community, integrate with it using atomic cross-chain swaps and run the smart contracts on a platform optimized for it. IDK, but seems to me it will be much easier to implement an interface to the EOS chain than to ETH.

I tend to think BitShares needs to A) define target audiences and B) list the features and functionality (in priority order) required for each audience identified, including completed, in development and what's next. Yes, that's marketing, but unless we can all point to a document or source that embodies these things BitShares will bounce from one pinball bumper to the next in reaction to the community concern of the day. We won't be focused and progress will be what it is now.

How does the upcoming HTLC functionality affect this discussion? Will you utilize HTLC to accomplish this?
Injustice anywhere is a threat to justice everywhere - MLK |  Verbaltech2 Witness Reports: https://bitsharestalk.org/index.php/topic,23902.0.html

Offline openledger

  • Board Moderator
  • Hero Member
  • *****
  • Posts: 1112
  • Blockchain powered, people driven
    • View Profile
    • OpenLedger.info - Blockchain Solutions, Services and Products for Businesses
  • BitShares: ccedkbts
Thank you Yury, I hope there will be a good amount of comments to this considering the work you have put into this already.

Time will show if BitShares community is ready to accept proposals like this one meant to help make BitShares an ecosystem useful to all other ecosystems out there. Part of getting the message out is to build and create products allowing other products to flourish using the core of BitShares to do so.

BitShares in its core essence is not really meant to be known by people of name but more of use, and we need this use to be made available in all the ways possible.

This proposal presented here is one of the strongest ones I have seen offered to the BitShares commmunity and I hope it is understood that this is an offer to act upon soonest possible really.

Yury is my VP of Business Development at my R&D office in Minsk, Belarus, called AETSoft (a full member of the High Tech Park of Belarus) and a valuable part of our core team within the OpenLedger organisation.

I hope everyone here will treat this proposal as a serious value added offer to the BitShares ecosystem and let us know soonest possible if the community is up for such added valuable feature.

I do personally hope to have lots of comments here

Yours sincerely

Ronny Boesing
CEO
OpenLedger ApS
OpenLedger blockchain in services and solutions - https://openledger.info
BitShares explorer: https://bitsharescan.com
BitShares commitee member since 2015

Offline yury

  • Jr. Member
  • **
  • Posts: 42
    • View Profile
    • openledger.info
Dear BitShares community members,
 
While the best minds of the community are doing their best to find new options to expand BitShares adoption worldwide and add more business use cases, the OpenLedger team just cannot stand still.

We’re proud of our previous work, and now we have come up with another big feature that can bring thousands of businesses to the BitShares ecosystem: on-chain smart contracts.

We all know that BitShares is the nearest thing to a perfect blockchain — fast, secure and cost effective, it also provides many valuable features to its users: UIAs, MPAs, DEX, multi-signature accounts, voting. Other valuable standard features are being constantly implemented.

Still, when it comes to business operations, you often find yourself limited by the standard functionality and are not able to implement your custom business logic. Of course, you can create a script on your server and execute BitShares operations in auto mode, but this is not what a true DApp needs. You need on-chain logic executed inside the consensus.

Smart contracts unleash a unique ability for counterparties to operate in a trustless environment and add more traction to BitShares perfect products like MPAs, allowing people to build a complex business logic operating price stable currencies in a decentralized environment.

Numerous business cases can be implemented: scheduled and ongoing (aka token streams) payments, insurance contracts, sophisticated financial products, funds escrow and vesting, crowdfunding automation and many others.

The examples of blockchains like Ethereum and EOS show us that smart contracts and DApps are here to stay and bring with them a new type of economy and a new way of doing business: DAOs, Decentralized Autonomous Organizations. BitShares, of course, will be a part of this bright future.

Although EOS is the most modern technology at the moment, it is still in its childhood and it is probably too early to be considered a trusted operation environment.

On the other hand, Ethereum Virtual Machine has proven its ability to operate, with thousands of smart contracts already implemented and a huge army of developers ready to implement new DApps. This is the reason we selected Ethereum VM to be integrated into BitShares core and allow on-chain smart contracts to be executed.

OpenLedger team has spent several month working on the solution and at this time we believe it is mature enough to be presented to the public!

Here you can find the solution description: https://drive.google.com/file/d/1NZHPojlyNGaGbAR6L9YmvjJu7_AAXDoY/view?usp=sharing

There has already been a testnet operating for several months, where you can run your smart contracts in Btishares environment. See details here: https://drive.google.com/file/d/1Pfe246M82gPfBF3zbabkYEUazjV-k3kj/view?usp=sharing

There is a technical discussion in GitHub: https://github.com/bitshares/bitshares-core/issues/1182
 
 
We are convinced that this solution can bring many new users to the ecosystem, stimulate its usage and adoption across business environments all over the world, and raise BTS demand and therefore price. 

However, community members have raised concerns, so we would like to start a public discussion of this opportunity and decide if it should be processed as a new WP.
 
Here are some of the concerns raised by BitShares members:

1. BitShares was not originally designed to run custom smart contracts, this is something totally different from the original idea.
==================================
Well, when BitShares were originally started in 2015, custom smart contracts were something extremely new and were not in the scope of the ecosystem. Nowadays, using on-chain scripts and DApps is a mainstream trend in the blockchain industry and there is no reason for BitShares to stay away from it.
 
2. Custom smart contracts may spam, contaminate and flood the blockchain, make it slow and heavy.
==================================
With the implementation of an appropriate fee management process, no spam contract is allowed — any operation is paid, raising BTS demand and price. The blockchain is meant to be used, this is what it was created for, so it doesn’t make sense to limit its usage.

Of course, the service must be well paid, and the BitShares committee will keep an eye on the fee schedule to regulate smart contracts fees and make sure they pay reasonable compensation to block producers.

According to many stress tests, BitShares is able to cope with at least 4,000 TPS, and at the moment the average number of transactions is around 20 TPS, so the blockchain seems to be massively underutilized and still has huge unused capacity.
 
3. There may be fraudulent or illegal contracts running in the network.
===================================
Unfortunately, this is true for any public blockchain and there is no sure remedy against it. Even at the moment there are scam coins and MPAs with 100% market fees operating and trading in BitShares. Implementation of VM changes nothing in this area.   


We do encourage public discussion of this proposal, your feedback is extremely welcomed!
Yury Cherniawsky
OpenLedger