4 ms·
Is there a reason existing programming languages cannot be used for smart contracts? The overhead of a new language seems quite high compared to the already est
by 88913527 4y ago
Is there a reason existing programming languages cannot be used for smart contracts? The overhead of a new language seems quite high compared to the already established engineering communities around widely adopted languages.
- LegionMammal978 4y agoAs I understand it, smart contract languages generally have to be specifically tailored to the primitive operations offered by the EVM (Ethereum Virtual Machine). Binary size is at a strict premium, because the price to deploy a smart contract (currently in the thousands of dollars on the main Ethereum network) directly depends on it.
- nradov 4y agoIf the Ethereum platform places such a heavy premium on binary size then that seems like a real step backwards from a software engineering perspective. Our industry has learned through painful experience that optimizing for highly compressed binaries isn't a great way to ensure program reliability or correctness.
- olalonde 4y agoSuch limitations aren't introduced for fun but stem from the desire to build a decentralized system. If you don't believe in decentralization or the separation of money from the state, then nearly all aspects of cryptocurrency will seem backwards to you. However, those who support decentralization view these limitations as necessary trade-offs.
- Gigachad 4y agoDid no one stop at the “it costs thousands of dollars to deploy a binary” step and realise this isn’t going to work? They don’t need a new language for smaller binaries, they need to solve what seems to be a core roadblock.
- Karrot_Kream 4y agoYes, and using L2s to scale throughput is a core part of the roadmap. https://ethereum.org/en/layer-2/ https://ethereum.org/en/layer-2/
- dagmx 4y agoAt that point, isn’t it just a highly over engineered cloud hosted but sharded web app?
- G3rn0ti 4y agoDon’t think in terms of a „web app“. Instead, consider this: A block chain is basically just a distributed append-only database. Actually quite similar to how GIT works but with stronger security guarantees.
- dagmx 4y agoThat doesn’t really answer the question of what it offers over a sharded cloud hosted web app if you’re having to move things to L2 to scale. Edit: also unrelated, but I hate the tendency for crypto fans to keep moving the conversation to new analogies. The vast majority of threads here are analogies and buzzwords without very concrete technical discussion of the merits of the architecture.
- cinntaile 4y ago> The vast majority of threads here are analogies and buzzwords without very concrete technical discussion of the merits of the architecture. > isn’t it just a highly over engineered cloud hosted but sharded web app? A bit ironic.
- dagmx 4y agoOne is asking for a difference, the other is presenting analogies for bits of the tech that weren’t part of the discussion
- mattdesl 4y ago> currently in the thousands of dollars on the main Ethereum network That’s not right. Here’s a recent contract that cost less than $20 to deploy. https://etherscan.io/tx/0xd21e1757649ace2fa5d9a1c0f36ddfb49580e38a78e7a62dcff09ded32cff01a https://etherscan.io/tx/0xd21e1757649ace2fa5d9a1c0f36ddfb495...
- LegionMammal978 4y agoThat's interesting. It appears that the resources I was looking at were mostly from last year, which had both higher gas fees in gwei and higher ETH prices in USD. This contract (at 1.2 M gas) still only comes out to the hundreds of dollars at most; perhaps it is smaller than the kind of contracts that most people were considering at the time. (Incidentally, why is it so difficult to find any good order-of-magnitude estimates of the gas usage of deploying a contract?)
- pcthrowaway 4y agoDetermining how much a contract will cost to deploy is really easy for blockchain devs (the "user-friendly" resources probably don't make this easy because it's not relevant to people who aren't doing it). Transactions on Ethereum all contain a certain amount of data which will live on the blockchain forever (often ~100 bytes, for non-contract-deployment transactions). Ethereum processes one block every 12 seconds, and blocks can contain up to 1 MB of data, so effectively people "bid" to get their transactions on by including the fee-per-byte they're willing to spend with their transaction (I'm glossing over a lot here, they're also bidding on computation resources for transactions which call code, and there is some dynamic targeting of fees, all to say that block sizes are typically much closer to 80 KB than 1MB) In order to get an idea of how much it would cost to deploy a contract, you first compile it (get the bytecode size) and then look at the typical "gas cost" (what transactions are currently paying in fees). You can get this data from the chain directly, or go to https://etherscan.io/ https://etherscan.io/ and look at the "Med gas price" (currently 14 gwei, or 0.000000014 ETH). Your dev tooling can tell you how much gas should be required to deploy the contract based on the bytecode size, the storage (space in the virtual machine reserved for that contract's variables), and the amount of computation that needs to happen in the contract's constructor. Once you know how much gas will be required to deploy the contract (the "gas amount") you multiply that by the gas price to get an amount of ETH. A very large contract might cost 8 million gas to deploy (gas is basically a unit used by the Ethereum virtual machine to price operations and storage). So if that's you, you multiply that by 0.000000014 ETH and get 0.112 ETH at the current gas price. If you want to pay less, you could always submit your transaction with a lower gas price (like 0.000000001 ETH lets say, to pay closer to 0.01 ETH); it'll just take longer to get validated (an indeterminate amount of time depending on how heavily the network is being used) Obviously I've glossed over a lot here to make things more approachable, but hopefully that explains the situation well enough. By the way, the tooling around blockchain development is still really primitive relative to its complexity; but contract deployment gas estimation isn't too hard for anyone doing it.
- G3rn0ti 4y agoThe total gas cost of a smart contract is determined by its running time that is the number of operations a smart contract needs to execute. So a large contract may actually be cheap to run if it never executes most of its code base.
- pcthrowaway 4y agoJust a clarification, it's not "thousands of dollars" to deploy a smart contract to Ethereum, though a defi application might be comprised of a group of related contracts. There's a limit on the size of a contract, and the largest contract one can deploy to Ethereum would cost about $120 at today's gas price and ETH price. For example, this transaction from a couple of hours ago deploys a contract that is at the contract size limit: https://etherscan.io/tx/0x5ed0c6d517fa0bf7c5074bf49ae0f7363355079abedf08d015d106fd411ef2b9 https://etherscan.io/tx/0x5ed0c6d517fa0bf7c5074bf49ae0f73633... You can see they spent $120 in gas fees to deploy it. When the network is incredibly busy, of course, this could be much higher (but when it's dead, it could also be as cheap as $40) At the peak of the bubble (ETH price around $5000), you're right, contracts this size would have been "thousands of dollars to deploy" when the network was congested. Even then, most contracts would have been cheaper, and you could still deploy contracts for $100-200 If ETH (the token) continues to appreciate in price then it's entirely possible "thousands of dollars" for a contract could become the norm, but that's obviously not a certainty, and if that does happen (before network improvements which may also decrease fees), there are always alternative blockchains and L2s that you could deploy Solidity contracts to.
- technion 4y agoThere have been plenty of attempts at this. Viper was based on Python: https://ethereum-viper.readthedocs.io/en/latest/ https://ethereum-viper.readthedocs.io/en/latest/ Simplicity was supposed to be the "technically better" language: https://blockstream.com/simplicity.pdf https://blockstream.com/simplicity.pdf I'm sure there were a few others I can't think of right now. Solana uses Rust for its contracts, and I can't mention Solana or any of the above without someone pointing these platforms died specifically because people writing these contracts like them being "javascript like". There's a really good comment on Solidity here, the fact it's "won" says a lot. https://news.ycombinator.com/item?id=14689792#14691212 https://news.ycombinator.com/item?id=14689792#14691212
- sam0x17 4y agoPolkadot uses Rust entirely and has on-chain WASM-based upgrades
- zie1ony 4y agoOdra Framework is in Rust. https://github.com/odradev/odra https://github.com/odradev/odra