"Is a smart contract legally accepted? What happens if one party defaults?"
That is a really great question. I think the term "smart contract" is very confusing for most people.
What is a smart contract? Well, it is not smart and it is not a contract. A smart contract is a dumb program.
A smart contract is a program written in a language that is executed inside a blockchain-based virtual machine.
It is a program. They are not particularly smart. They are fairly unsophisticated software programs,
the important part being that they manage money.
Could they have legal implications? Could they be legally binding? Perhaps.
Especially if combined with some kind of written legal contract.
There are many jurisdictions in which various forms of agreements, whether written or not, are considered...
legally binding, so there is no reason why a smart contract could not be legally binding.
However, this depends on the jurisdiction and what the legal precedents are.
Until there is more established case law- I am not a lawyer, so I am just giving you my opinion on this.
Until there is more established case work on this, the term "smart contract" is very loosely used,
and should not be considered a contract.
For the second part of your question, "What happens if one party defaults?"
If the smart contract handles that particular case in its program, then something happens on the blockchain.
Is that legally binding or not? I don't know. That is a question you must ask a lawyer.
This is the really interesting thing, this is not a matter of law if smart contracts are not a legal construct.
They are software construct. They [execute programs] on blockchains.
Whether those things are within the law, accepted or recognized by the law, has nothing to do with...
how the smart contract works.
"How is a token singled out and designated to represent ownership of a house, for example?"
"How can I decide that a particular token will represent ownership, and then code that into the token?"
"Can you explain how this works?"
Usually this works with some kind of external data store, even a decentralized file storage system like IPFS...
or Ethereum Swarm.
For example, you would store some PDF document, such as the deed of the house or some other title,
or a reference to the municipal state or government registry of titles.
You could encode that information into a token.
The real question is, if you transfer that token to someone else, does that also transfer the title?
In most jurisdictions, no.
A lot of people are trying to get laws passed that recognize the transfer of ownership of the asset...
when the token that contains the title, or hash of the title, is transferred.
That [will be] harder, really. This is the difference between software and law.
Just because you can transfer a token in software, doesn't mean you can take that token ownership...
to your local planning office and say, "Hey, I own this land and this house," and have that legally recognized.
That is one leap further down.
"Where are Ethereum transactions stored after executing the contract code?" That is a great question.
Ethereum transactions are stored on the blockchain, just like Bitcoin transactions are stored on the blockchain.
The difference is, while Bitcoin tracks the state of ownership of unspent transaction outputs (UTXO),
in Ethereum the transactions may trigger the execution of a smart contract, which can...
modify the state of a contract or an account within Ethereum.
Ethereum transactions track and cause changes, or transitions, in any form of state.
That could be data within a contract or the balance of an account, a much broader set of state.
There are actually two things stored in the Ethereum blockchain. The first thing is the transaction itself.
The second thing is the transaction logs, or receipts as they're called,
which show what changes this transaction caused to the global state.
The contract execution itself isn't stored on the blockchain. You store what started the contract,
and you store what state changes happened because of the execution of the contract,
but the execution of the contract itself is not stored on the blockchain.
You store the inputs (transactions) and the outputs (state changes) of smart contracts.
Those are the two things stored on the Ethereum blockchain.
Anyone can validate this information by taking that same transaction stored on the blockchain,
running it through the smart contract on the Ethereum virtual machine, and then looking at the output logs...
to see what state changes or transitions occurred during the execution of the smart contract.
You can then compare those with the receipts or logs stored in the Ethereum blockchain.
Every single validating node on Ethereum should arrive at exactly the same answer;
the same transaction should cause the same transitions, and produce the same receipts or logs.
That is how Ethereum validation is done.
"Is there enough being done to confirm that smart contracts will work in the way people envisioned?"
The problem is, the vision is far more expansive than what can currently be done with smart contracts.
People envision all kinds of things. Whether you can do all those things is a whole other question.
Sometimes people go too far with crazy ideas, even to replace things that currently work, with smart contracts.
"Smart contract" is beginning to become as vague and full of bullshit as the terms "blockchain" or "AI."
It doesn't really mean what most people think it means.
"Do you think it is possible to combine smart contracts with artificial intelligence (AI) and machine learning?"
Maybe, in very small ways [for now]. Not in any practical way anytime soon.
These are both very new and immature technologies. I mean smart contracts, AI, and machine learning.
While they are progressing really fast, they are not necessarily easy to combine.
What happens if you take smart contracts and combine it with AI?
You have multiplied all the risks and problems of one immature technology, with the risks and problems...
of another immature technology.
It makes for a fantastic marketing brochure, and you will probably raise a lot of venture capital from investors...
who don't really understand what AI, machine learning, or smart contracts are,
but nonetheless are very impressed by these buzzwords.
The truth is, doing anything involving two experimental technologies increases your risks exponentially.
I don't expect we will see any useful, practical, relevant, or interesting applications combining...
AI and smart contracts in the next several years, perhaps even decade.