Bitcoin Forum

Bitcoin => Development & Technical Discussion => Topic started by: oshirowanen on May 06, 2018, 07:12:31 PM



Title: Is it possible to create a simple smart contract using bitcoin-cli?
Post by: oshirowanen on May 06, 2018, 07:12:31 PM
I have an interest in smart contracts.  For example, something simple like "bitcoin in a specific address cannot be spent until 2019-01-01".

How do I go about creating this using bitcoin-cli?

I already know how to create simple raw transactions and simple multisig raw transactions, but I can't seem to figure out how to create simple smart contracts, specifically timelocks.


Title: Re: Is it possible to create a simple smart contract using bitcoin-cli?
Post by: RGBKey on May 06, 2018, 08:21:37 PM
Bitcoin doesn't really have "smart contracts" per se. It does have a scripting system though, which is generally how timelock transactions are created.

It looks like what you want is possible through the CreateRawTransaction RPC method (https://bitcoin.org/en/developer-reference#createrawtransaction) available through bitcoin-cli. Just scroll down to Parameter #3—locktime for details on how to use it.

It's possible there's an easier way to do it, but this is the first thing that I saw looking through the API docs.


Title: Re: Is it possible to create a simple smart contract using bitcoin-cli?
Post by: Membrana.io on May 07, 2018, 10:06:42 AM
Bitcoin doesn't really have "smart contracts" per se. It does have a scripting system though, which is generally how timelock transactions are created.

It looks like what you want is possible through the CreateRawTransaction RPC method (https://bitcoin.org/en/developer-reference#createrawtransaction) available through bitcoin-cli. Just scroll down to Parameter #3—locktime for details on how to use it.

It's possible there's an easier way to do it, but this is the first thing that I saw looking through the API docs.
So many people wan to use btc in smart-contracts, but i know from that forum, that it is impossible....
Smart contracts it is only Ethereum, or something else?


Title: Re: Is it possible to create a simple smart contract using bitcoin-cli?
Post by: veleten on May 07, 2018, 04:17:22 PM
Bitcoin doesn't really have "smart contracts" per se. It does have a scripting system though, which is generally how timelock transactions are created.

It looks like what you want is possible through the CreateRawTransaction RPC method (https://bitcoin.org/en/developer-reference#createrawtransaction) available through bitcoin-cli. Just scroll down to Parameter #3—locktime for details on how to use it.

It's possible there's an easier way to do it, but this is the first thing that I saw looking through the API docs.
So many people wan to use btc in smart-contracts, but i know from that forum, that it is impossible....
Smart contracts it is only Ethereum, or something else?


many other cryptocurrencies are smart contract friendly
for example:1. EOS asynchronous smart contracts,their declared aim,by the way, is to be able to process hundreds of thousands if not millions of transactions per second
2.Qtum -POS smart contracts,able to run both Eth and BTC applications
mostly large business oriented
3.ADA -the self proclaimed "ETH killer",next generation smart contract platform,potentially issuing their own credit card too
took the market by the storm and keeps gaining momentum and capitalisation

speaking of bitcoin+smart contracts:
particl.io is managing funds in  their trustless escrow ,using smart contracts
https://bitcoinmagazine.com/articles/yes-bitcoin-can-do-smart-contracts-and-particl-demonstrates-how/
think there are much more examples,but to use bitcoin blockchain for smart contracts is like if you are hammering nails with a screwdriver-technologically possible,but really unneccessary and awkward


Title: Re: Is it possible to create a simple smart contract using bitcoin-cli?
Post by: liverock on May 08, 2018, 05:00:51 AM
The bitcoin network does not support Smart Contracts.
Try Ethereum.
QTUM has an additional abstract layer that is compatible to both Bitcoin and Ethereum.


Title: Re: Is it possible to create a simple smart contract using bitcoin-cli?
Post by: arunchain on May 09, 2018, 06:24:03 AM
Well now a days Bitcoin also supports smart contracts, not directly but definitely

Rest, ping me on Telegram: @arunsachdeva for further better and smooth communication


Title: Re: Is it possible to create a simple smart contract using bitcoin-cli?
Post by: pebwindkraft on May 09, 2018, 06:59:43 PM
too many people throw their Blabla statements "bitcoin has no smart contracts" - this is simply not true. Counter question would be how these people understand smart contracts, and usually they confuse this with a "turing complete" language. I did a summary of smart contracts with some links here:
https://bitcointalk.org/index.php?topic=2204938.msg23664225#msg23664225

Anyhow, I posted an answer to your request on bitcoin.stackexchange.
I try to show the steps at the command line, starting easy with a simple secret and an OP_IF/ELSE/ENDIF statement:
https://bitcoin.stackexchange.com/questions/74753/


Title: Re: Is it possible to create a simple smart contract using bitcoin-cli?
Post by: r1s2g3 on May 12, 2018, 09:50:40 PM
I have an interest in smart contracts.  For example, something simple like "bitcoin in a specific address cannot be spent until 2019-01-01".

How do I go about creating this using bitcoin-cli?

I already know how to create simple raw transactions and simple multisig raw transactions, but I can't seem to figure out how to create simple smart contracts, specifically timelocks.

I think the example you are giving is implemented by timelocks.
AFIAK the smart contracts on bitcoin can be done using rootstock (RSK). It is open source platform and RSK work as bitcoin sidechain.
You can get more information about them in their site https://www.rsk.co/