8 ms·
how do you get started with "smart contracts"? all the "tutorials" always end creating your own crypto and that's it.... i need something basic, like alice and
by 2Gkashmiri 4y ago
how do you get started with "smart contracts"? all the "tutorials" always end creating your own crypto and that's it....
i need something basic, like alice and bob contract to sell 100 watermelons for 1 BTC and sarah is the arbitrator in case they have a problem... something like this.
or a smart contract to validate a sale of a house for 2 BTC.
or a partnership deed for a business between alice and bob with 3 clauses
- Arnavion 4y agoI only have a surface-level understanding of smart contracts, but you'd need an oracle for the off-chain validation part of the three situations you mentioned, and https://ethereum.org/en/developers/docs/oracles/ https://ethereum.org/en/developers/docs/oracles/ seems to have some contract examples.
- yieldcrv 4y agohm creating your own crypto token is a smart contract, its just a standardized set of classes, modify the classes and see what happens anyway try scaffoldeth.io you compile the tutorial website first and then build a bunch of common smart contract scaffolding note this is the EVM ecosystem so it would be impossible to conflate example in pure BTC, smart contracts are playing catchup in BTC ecosystem. There are a couple competing attempts there, very little scaffolding. There are many orders of magnitude more activity in the EVM ecosystem than there are in bitcoin ecosystem/UXTO model smart contracts.
- montenegrohugo 4y agoWhat's the hangup with normal tutorials? There's a plethora of tutorials online. People recommend ethernauts[1] and cryptozombies[2], but I found those quite slow when I was learning. Most useful for me was reading existing implementations of smart contracts, and learning from there. M1guelpf wrote these a while ago, might be helpful examples: https://github.com/m1guelpf/lil-web3 https://github.com/m1guelpf/lil-web3 happy to chat if you need help [1] https://ethernaut.openzeppelin.com/ https://ethernaut.openzeppelin.com/ [2] https://cryptozombies.io https://cryptozombies.io
- saurik 4y agohttps://cryptozombies.io/ https://cryptozombies.io/ ?
- bmelton 4y agoFor Solidity-based tokens, learn Solidity to be able to know the syntax for creating your contract. After developing the contract, use something like Truffle Suite to validate that the contract is good, and add a testing suite around it.[1] Find a test net for the coin that you're developing for and create an account. Generally testnets will allow you to have "play money" to work with. This will allow you to learn how to deploy your contract to the testnet (which is functionally identical to mainnet) Deploy it there, test it further. Write apps around it with tools like web3.js or eth.js as appropriate. Buy some currency for the applicable mainnet and deploy your contract to mainnet just as you did with testnet, only this time it'll cost actual currency to deploy -- this will vary wildly by network and token and such. This guy's videos are pretty helpful: https://www.dappuniversity.com/articles/the-ultimate-ethereum-dapp-tutorial https://www.dappuniversity.com/articles/the-ultimate-ethereu... Different tokens have different protocols and such. The above works for Eth and Eth-based tokens. Cardano is Haskell-based, and refers to smart contracts as programs, and the process is wildly different. Some other tokens use Rust, or other languages, but the BASIC outline I've laid out is basically the same no matter which (except for Cardano, which may be the same, I have no idea.) [1] - https://trufflesuite.com/ https://trufflesuite.com/
- sschueller 4y agoAnything that connects to the physical world makes little sense at the moment as it defeats the purpose of such a smart contract. What you can do is anything that is related to moving ETH or ERC tokens/NFTs between addresses. So an example that you see often is a Kickstarter type contract. This contract collects ETH from many sources over a period of time but will only pay out to the payout address if the minimum is reached in that time period. Otherwise all the funds are returned. This contract is fully autonomous and can be validated to do what it is supposed to do. You don't have to trust a single company like Kickstarter to follow the rules or not cancled your compain. The project being a scam or not compleeting is another story. So in other words what you can do in a smart contract are financial constructs that are zero trust. The reason many scams happen is also in part that people are not checking that the contracts are solid and prevent rug pulls etc.
- imtringued 4y agoYeah remember, you're supposed to upload your mind into the computer if you want to live in that kind of world. What will happen to you in the case of a fork? There will be two of you.
- fwip 4y ago> Anything that connects to the physical world makes little sense at the moment as it defeats the purpose of such a smart contract. Which is why they're useless except for implementing complicated financial schemes. Which, in practice, are mostly scams.
- cortesoft 4y agoI don’t understand the benefit of that… in the end, you have to trust the person you are sending the coins to to do what they say the will. This is true regardless of the smart contract. The only thing the smart contract does is guarantee that at least other people are also getting scammed. Come to think of it, though, it doesn’t even guarantee that. The person who created the contract and will get the funds if the minimum is reached could always just send ETH from one of their other own accounts to trigger the threshold.
- 4y ago
- charcircuit 4y agoStart here https://remix.ethereum.org https://remix.ethereum.org. This IDE lets you test smrt contracts in an emulator. You can get a quick overview of solidity here https://learnxinyminutes.com/docs/solidity/ https://learnxinyminutes.com/docs/solidity/ and the docs are here https://docs.soliditylang.org/en/latest/ https://docs.soliditylang.org/en/latest/ >alice and bob contract to sell 100 watermelons for 1 BTC and sarah is the arbitrator in case they have a problem... something like this You create an owner variable that is used to show who can withdraw from the smart contract and is set to 0 at the start. You add 2 methods. The first is a method that is only usable by Sarah that lets her change the owner variable. The second is a withdraw function that is only usable by the owner. You can even enforce that the owner can only be set to Alice or Bob if you want. Bob deposits 1 wrapped BTC. If Alice gives him the watermolens Sarah sets Alice as the owner. If Alice doesn't Sarah sets Bob as the owner. >a smart contract to validate a sale of a house for 2 BTC. You don't need a smart contract for that. Every transaction already gets validated by the network. >a partnership deed for a business between alice and bob with 3 clauses This depends on the clauses but you would put all the company assets into the smart contract and then write methods that let you spend those assets while not violating those clauses.
- throwaway98797 4y agogive crypto zombies a try: https://cryptozombies.io/ https://cryptozombies.io/
- hanniabu 4y agoCryptozombies is great for getting started, after that you can try the ethereum speedrun courses