7

Note that this question has been automatically mapped to reddit and answered there. If you declare your state variables as public, a function to read their values will be automatically created by the compiler ("accessor function"). If you use the rich interface provided by web3.js, you can create a javascript contract object and just call message() on that ...


6

Bitcoin has a scripting language built into it, which allows the creation of many kinds of smart contracts. Examples are atomic swaps, Lightning payment channels and zero-knowledge contingent payments (ZKCPs). This later paper by Banasik, Dziembowski and Malinowski (BDM16) improves the efficiency of these greatly. Threshold multisignatures are also easy to ...


6

Yes, Bitcoin could also be subjected to a hardfork. In fact, there are members of the Bitcoin community that feel so strongly that the blocksize should be increased that they are proposing to do just that: They are working on a version of Bitcoin that is incompatible in regard to the current consensus rules of Bitcoin forcing a permanent split of the ...


6

A smart contract can only initiate a transaction when it receives a transaction from either another contract or a user. Thus, all transactions must originate from some user transaction, and it is this transaction that must pay for fees. The amount of fees can be limited by setting the gas limit on that transaction to prevent a malicious contract from ...


5

You can separate concerns - have a contract that the users interface with and that has a reference (an address) of another contract that contains the actual logic. Then, you can control the interface contract and update it with the address of the logic contract on updates.


4

Refer to the documentation: delete myArray[arrayIndex];


4

First off, Lisk doesn't have full turing-complete smart contracts so there isn't much of a comparison on that front. Key shortcomings of existing frameworks like Ethereum can be summarized by five challenges: Contract life cycle management – Find a security bug? Good luck re-deploying. Transaction fees – Want to use my service? First, you’ll have to buy ...


3

there is no such improvement planned for the protocol, only the expected BIP are listed in https://github.com/bitcoin/bips/blob/master/README.mediawiki. but you should understand why in bitcoin only a limited scripting mechanism is used instead a VM with a contract language as for Ethereum (security reasons). the project RSK aims to provide such opportunity ...


3

It is not, sadly. There was a proposal for an ALARM opcode, but it was marked WONTFIX - https://github.com/ethereum/go-ethereum/issues/117 I can see why - timers require that you keep your contract topped up with Ether, and making them too easy to create could litter the blockchain with them and impose an overhead on miners. You either have to have an ...


3

It's a standard. ALL those ERC20 based tokens have (at least) the same attribute names, the same method names. So I do automaticly know that I need to call the method "transfer" when I want to transfer my tokens. No one would name it "transfer_tokens_hello_world". Irrelevant which of the thousands of token I want to transfer: It's always the same method. ...


2

This feature can be easily realised outside the Ethereum virtual machine (and thus keeping the VM simple): Create a (reusable) contract where contracts can register to be called at a certain time (and provide a reward as compensation for the gas costs). A script can poll this contract from outside and call it at the appropriate times. The contract could be ...


2

It is not in "the" ethereum spec, so no. But it is a feature that has been discussed for "ethereum 2.0" or similar. It is possible that there may even be a hard fork that will enable it in the then-existing network, but there are none currently planned.


2

No you cannot. A nice way to mimic mutability is via name registration. You can register a name which you distribute to users or use in dapps and other contracts. Whenever you update you update your entry to point to your current contract address.


2

In one word: no. Changing tx output after signing makes existing signature invalid. ( There are some special cases, like signature hash type SIGHASH_SINGLE or SIGHASH_NONE, but we assume that the buyer uses correct signing SIGHASH_ALL )


2

You get a gas refund of 15000 for resetting a storage slot to zero, but you have to use this gas during the current transaction (more specifically, you get at most one half of the total spent gas as a refund). This means you can trade some cleanup with other operations, but you will never be returned such refunded gas in ether. So the general idea is that ...


2

Bitcoin script only allows the conditions under which an output can be spent to be controlled, it does not provide a method for dictating what can happen to the output once these conditions have been satisfied. The concept you are describing is called a coin covenant, the linked thread goes into some detail explaining why this is generally a bad idea.


2

If you want the operation of removing an element from a list to be efficient (i.e. without having to copy the list), you have to use a different data structure, e.g. a linked list or a mapping with a reverse index. Note that delete arr[ind] does not rearrange the array but only resets the array element.


2

Yes. But smart use of smart contacts means you don't need to put all the data on the blockchain. You can keep the actual data offline or only shared between actual participants. Lightning Network is a nice example of such a system. Many other examples can be done using simply multisig and a bit of time locking if necessary. More op-codes and more flexible ...


2

The blockchain does not contain yet-to-be-published transactions to publish them based on conditions. The blockchain is the structure that transactions are published to. There is no such thing as a "pre-loaded transaction" that can be "released". Either A (Alice) or B (Bob) has to publish it. What Alice can do is give Bob a pre-signed transaction that ...


2

Tokens, in general, are not the same as shares in that they do not provide ownership stake or voting rights in the corporation. Typically, they are simply vehicles with which to conduct transactions for the goods or services within the corporate entity from which they are issued. After the ICO where the company sets the price for the tokens, their value is ...


2

I would like to explain a bit the smart contract situation in bitcoin, as a "smart contract platform" is not a fixed wording in bitcoin world. As such your question is not clear. Bitcoin already has smart contracts. A good summary was provided by Andrew Poelstra here. When you mention Ethereum, then usually solidity is used, which is "turing complete". ...


2

A node that runs a smart contract will be paid with GAS. This is incorrect. The miner who mines the block containing the transaction interacting with a contract is the one who is paid with ETH, which is gas consumed * gas price. How is this node selected? Through the mining process. Or multiple nodes are running the same smart contract just to make ...


2

One idea how to solve it works like this: The sender submits the contract trigger transaction as phased with a reveal secret approval model based on the hash of a secret it generates. The contract activated by this trigger transaction, submits the response transaction(s) with a composite approval model composed of the same hash of the secret used by the ...


1

If I've understood correctly, I don't think you need block-chain technology to achieve what you want. This is exactly what asymmetric public key encryption is designed for. A simply encrypts some information using A's private key and B's public key... thereby ensuring: Only B can decrypt the information B can verify the information was encrypted by A (...


1

Ivy is a higher-level language that allows you to write smart contracts for the Bitcoin protocol. It can compile to instructions for Bitcoin’s virtual machine, Bitcoin Script, and can be used to create SegWit-compatible Bitcoin addresses. Ivy GitHub Repository Another interesting approach is to use RSK. Rootstock is a project to execute smart contracts (...


1

Are contracts described here already available for use? Yes. Some of them are admittedly kind of arbitrary. For example, you can trustlessly sell someone a solution to a Sudoku. What does that mean? If you don't really have a solution, there is no chance that you will receive the money. If the other person doesn't give you the money, it's very unlikely ...


1

Smart contract functionality for Bitcoin is being planned via Rootstock: https://coins.newbium.com/post/292-what-is-rootstock-cryptocurrency


1

Improvements are made to Bitcoin's scripting language via Bitcoin Improvement Proposals, or "BIPs." Not all BIPs are focused on script, but some are. New op codes are introduced and agreed upon by developers and miners. Recent examples of this are BIP 65 and BIP 68. One of the benefits of BIP 144, or "Segregated Witness," is that its adoption should make ...


1

Had you seen http://rootstock.io/ ? Keep in mind that the bitcoin script language is not turing complete as the Ethereum VM


1

I'm not sure whether this was what you meant or not, but at Bitcoin 2014 I saw a prototype for NFC payments. The payer was offline and using his smartphone to create a transaction, which he then directly sent to the recipient via Near Field Communication. Since it is a valid transaction, it doesn't matter who transmits it to the network, and therefore the ...


Only top voted, non community-wiki answers of a minimum length are eligible