Introducing Smart Contracts for Bitcoin With GearSV
Bitcoin developers and members of the community have been some of the most constructive kinds when it comes from Bitcoin. The latter, including such individuals like neon Planaria, Bitbus Library, and underwriter have provided a new an interesting way for mining nodes to be easily synchronized with the off-chain application state.
It's thanks to this kind of solution that Bitcoin has the means to order blocks based on their relative heights, but also inner block indexing of any transactions. Just what this means is something pretty remarkable, The tape itself is all the was needed in order to build, not only more complex applications but ones that are wholly Turing complete on Bitcoin.
The Planaria Security Model
Firstly, Greater Consistency and Availability –
Any and all servers that make use of this application code can effectively die for any kind of span of time and still be able to recover the same level of effectiveness by scraping from the last seen block. What this means is that application providers can easily shut down and come back online with little to no risk of consistency. While this is an effective solution, it's one that is only available depending on the associated economic incentive of providing this kind of application to users.
Second – Improved Validation –
Any users within the Bitcoin ecosystem have the ability to boot up an application server and validate their and its current state. Just how this works for a validator is that it begins by acquiring the code for the application, before scraping from the first block that the app was seen up until the current block height.
This is what we commonly refer to as a linear time validation system, and it's akin to mining nodes on the Bitcoin core network. the only difference would be that it takes place with only a single application subset within the blockchain state.
Lastly, Law –
If there are any providers of APIs that are attempting to spoof in any kind of way by providing a false contract state, it becomes all the more challenging to catch and hold them to proper account; especially considering the kind of challenges that comes with trying to provide any kind of substantive evidence in court.
Ultimately, with this kind of upgrade, since it all now derives from tape that is on-chain, there is no way at all for them to get away with it by simply ‘cooking the books.'
Memory Plugins And CPUs
Some of the apps that currently use Planaria are effectively extensions of Bitcoin, designed with the purpose of providing greater hard drive space and support. Some of these include Twetch and Bicomedia. In addition to this, these kinds of apps have the ability to scrape and serve static content on a filesystem from Op_return events.
Overall, the underlying goal of GearSV is to provide a far more boundless volume of CPU space and memory, which can be easily added to Bitcoin. What does this allow Bitcoin to do exactly? Imagine if you have the means with which to provide far more complicated arbitrary data manipulation as well as provide for far more challenging validation, all with the same underlying properties as storage apps, but at a greater level? That's what it provides.
So as some brief context for what Virtual Machines are – they operate as a layer over an underlying blockchain's hardware. This allows for the systems computational layer to run effectively in conjunction with a wider range of CPU architectures – the better the VM, the better the range of architectures that it can run.
Virtual Machines are especially useful for smart contracts that are needed by users for a longer span of time and on a wider variety of machines. ARM services, for all we know, may, in fact, come into vogue over the next few years thanks to their effectiveness.
Through the use of this solution – developers can create effective class-based programs that are commonly seen from Solidity. Here's a step by step on how you can.
Firstly – Compile your contract in order to generate Bytecode and ABI
Second – Deploy contact Bytecode into an on-chain Op_return
Much akin to other platforms with a smart contract solution – the user then ‘deploys' this contract by storing the associated Bytecde on-chain within an op_return output. Just how the contract identifier is determined by the. transaction hash is through the use of the b://protocol.
Now, To Writing
Any and all writes are ultimately on chain transactions which use a higher level of semantics in order to specify the contract method, and input each of the parameters into an op_return. What Planaria and its nodes do is scrape the event log and run the needed method calls in order as they would happen on-chain.
These developers can then easily use commodity hardware or virtual CPUs, which are available through various cloud platforms in order to get started with this.
When using a smart contract based upon WASM, the limiting factor comes from the kind of memory it has. For a token contract that uses something more like a C++ std::map with an associated 34-byte address going to a 32 byte unsigned int, there will effectively be more than 200 million balances taking place on a machine with 16 GB worth of memory; causing a very possible bottleneck.
So how can we get past this kind of memory limit? Contract creators can make use of the Web Assembly MemFS, mounting it to the Operating System underneath it. By doing so, you can leverage its associated hard drives.
In stark contrast to platforms such as Ethereum, where smart contracts are operated and run within a single Virtual Machine. Bitcoin's new smart contracts operate in a much more ‘sharded' way; with one virtual machine working to operate and run a single smart contract.
It's thanks to this kind of solution that developers could ultimately run an unlimited number of virtual machines per contract in order to significantly improve, not just the availability of them to end-users, but to assure reciprocal ease of use through in-built scalability.
So, In Conclusion
What this solution ultimately means is, not only can you write and deploy smart contracts on top of Bitcoin. But this allows for a far more scalable, versatile, and efficient way of doing so.
As we've seen from other developers – the single most common and proven use case for these kinds of contracts is tokens. Having a highly strict and otherwise rigid op_return framework such as the one provided by Tokenized provides too much of an inflexible solution for developers – constraining the use cases that come with something as all-encompassing as tokens.
Offering a far greater degree of programmatic flexibility means that developers can actually specify sophisticated contracts with features like vesting schedules, Dutch auctioning mechanics, check approvals along with a lot more.