Skip to content

Commit

Permalink
merge conflict fix
Browse files Browse the repository at this point in the history
  • Loading branch information
martinseanhunt committed Sep 16, 2021
2 parents 3b6778e + 4ca0450 commit 402a7be
Show file tree
Hide file tree
Showing 5 changed files with 101 additions and 40 deletions.
34 changes: 20 additions & 14 deletions content/02-getting-started/01-installing-the-cardano-node.mdx
Expand Up @@ -3,10 +3,14 @@ title: Installing the Cardano node
metaTitle: Installing the Cardano node
---

You can install the Cardano node using
## Downloading pre-compiled executables

You can install the Cardano node and cli using
[pre-compiled executable files](https://github.com/input-output-hk/cardano-node#linux-executable)
for your platform.

## Building from source

Alternatively, if you want to build from source, there are two options
available to you. Depending on your build tool preference, you can build from
the source code using either of the following:
Expand All @@ -19,15 +23,15 @@ Please refer to the [cardano-node releases page](https://github.com/input-output
Once you have installed the node, you need to
[specify the configuration parameters](https://github.com/input-output-hk/cardano-node/blob/master/doc/getting-started/understanding-config-files.md/).

### How to Run the Cardano node and CLI using Docker
## Using Docker
There is also a Docker image available that you can use.

#### Setting up Docker
### Setting up Docker

1. Download and install Docker/Docker Desktop from the [Docker site](https://docs.docker.com/get-docker/).
2. If using Windows or Mac, ensure you have allocated enough RAM to Docker (we recommend setting the RAM to 8GB in the Docker Desktop requirements) and start the Docker daemon, as described in the Docker instructions. Note that Docker on Linux, there are no RAM limits for containers by default.

#### Setting up the Cardano node
### Setting up the Cardano node
1. Download the correct `cardano-node` image:

``docker image pull inputoutput/cardano-node:<TAG>``
Expand All @@ -41,24 +45,24 @@ docker volume create cardano-node-data
docker volume create cardano-node-ipc
```

## Running the Cardano node
### Running the Cardano node

1. Run a passive node that is connected to the correct network. For example, for a `mainnet` node:

``docker run -e NETWORK=mainnet -v cardano-node-ipc:/ipc -v cardano-node-data:/data inputoutput/cardano-node``

This creates a persistent docker environment for the node, where `/ipc` in the Docker container is connected to the logical `cardano-node-ipc` volume, and `/data` is connected to the `cardano-node-data` volume. Note that you should change `NETWORK=mainnet` if you are connecting to a different network (eg a testnet).

### Passing Explicit Configuration Parameters
You may also run the node with specific parameters:

``docker run -v cardano-node-ipc:/ipc -v cardano-node-data:/data inputoutput/cardano-node run --help``

### Passing Explicit Configuration Parameters
If there is no pre-defined network configuration, you will need to download the specified configuration files, copy these to the persistent Docker volume, and pass the parameters on the command line:

``docker run -v cardano-node-ipc:/ipc -v cardano-node-data:/data inputoutput/cardano-node run --config ... --topology ... --...``

## Running Cardano CLI commands
### Running Cardano CLI commands
You can now run normal Cardano CLI commands, for example,
```
export CLI='docker run -it --entrypoint cardano-cli -e NETWORK=mainnet -e CARDANO_NODE_SOCKET_PATH=/ipc/node.socket -v cardano-node-ipc:/ipc inputoutput/cardano-node'
Expand All @@ -68,10 +72,10 @@ $CLI transaction build-raw ... --mainnet
```
You need to specify `CARDANO_NODE_SOCKET_PATH` to point to the correct location in the container (`/ipc/node.socket` is the standard location).

## Running a Shell in the Docker Container
### Running a Shell in the Docker Container
To run a shell in the container (so that you can inspect or change settings, for example), use the `bash` or `sh` entry point.

``docker run -it --entrypoint bash -v node-ipc:/ipc -v cardano-node-data:/data inputoutput/cardano-node``
``docker run -it --entrypoint bash -v cardano-node-ipc:/ipc -v cardano-node-data:/data inputoutput/cardano-node``

You may now run any commands that you require with full access to the container's file systems.

Expand All @@ -82,13 +86,15 @@ immutable ledger lock protocolMagicId volatile
bash-4.4#
```

Alternatively, you can start the node container with a name:
`docker run --name cardano-node -e NETWORK=mainnet -v cardano-node-ipc:/ipc -v cardano-node-data:/data inputoutput/cardano-node`
Alternatively, you can start the node container with a name.

``docker run --name cardano-node -e NETWORK=mainnet -v cardano-node-ipc:/ipc -v cardano-node-data:/data inputoutput/cardano-node``

In a separate terminal instance, run shell in an existing container.

In a separate terminal instance, run shell in an existing container:
`docker exec -it cardano-node bash`
``docker exec -it cardano-node bash``

## Copying files to/from the Docker Container
### Copying files to/from the Docker Container
To copy files to/from the docker container use `docker cp`.

For example, if the process ID of the running container is `760199bf3561`
Expand Down
16 changes: 6 additions & 10 deletions content/04-core-concepts/06-pledging-and-delegation-options.mdx
Expand Up @@ -80,34 +80,30 @@ party.
**A**: Please review the steps in the documentation
[here.](https://github.com/input-output-hk/cardano-node/blob/master/doc/stake-pool-operations/getConfigFiles_AND_Connect.md)

2. **Q: How do I generate staking addresses?**
1. **Q: How do I generate staking addresses?**

**A**: Please review the steps in the documentation
[here.](https://github.com/input-output-hk/cardano-node/blob/master/doc/stake-pool-operations/register_key.md)

3. **Q: How do I determine an optimal amount of ada to pledge to each pool?**
1. **Q: How do I determine an optimal amount of ada to pledge to each pool?**

**A**: This is a personal preference, the more you pledge the higher the
rewards.

4. **Q: How do I know if my pool is oversaturated?**
1. **Q: How do I know if my pool is oversaturated?**

**A**: If the amount of ada delegated to the pool is over 32 million, the
pool is oversaturated.

5. **Q: How do I know who has delegated to my pool?**
1. **Q: How do I know who has delegated to my pool?**

**A**: You can query the ledger state.

6. **Q: How do I know who has delegated to my pool?**

**A**: You can query the ledger state.

7. **Q: How can I calculate rewards?**
1. **Q: How can I calculate rewards?**

**A**: This is calculated automatically by the Ouroboros protocol.

8. **Q: How can I verify whether my pool was successfully registered on
1. **Q: How can I verify whether my pool was successfully registered on
mainnet?**

**A**: You can check [pooltool.io](https://pooltool.io/) or run the following
Expand Down
89 changes: 74 additions & 15 deletions content/10-plutus/03-ledger-model.md
@@ -1,35 +1,94 @@
---
title: About the Ledger model
metaTitle: About the Ledger model
metaTitle: About the Ledger model
---

Cardano, like any other blockchain, is a distributed ledger or database that records all transactions and blocks created on the chain. This database shares records across all participants and synchronizes continuously with blockchain activities to provide transparent and up-to-date information for anyone to access.
Cardano, like any other blockchain, is a distributed ledger or database that
records all transactions and blocks created on the chain. This database shares
records across all participants and synchronizes continuously with blockchain
activities to provide transparent and up-to-date information for anyone to
access.

[Cardano DB Sync](https://docs.cardano.org/cardano-components/cardano-db-sync) fetches such blockchain records and allows users to [query transaction and block details using CLI commands](https://docs.cardano.org/explore-cardano/cardano-architecture/working-with-db-sync). For more convenient and user-friendly data exploration, you can use the [Cardano Explorer](https://explorer.cardano.org/en.html) – a graphical user interface that presents details in a simple way.
[Cardano DB Sync](https://docs.cardano.org/cardano-components/cardano-db-sync)
fetches such blockchain records and allows users to
[query transaction and block details using CLI commands](https://docs.cardano.org/explore-cardano/cardano-architecture/working-with-db-sync).
For more convenient and user-friendly data exploration, you can use the
[Cardano Explorer](https://explorer.cardano.org/en.html) – a graphical user
interface that presents details in a simple way.

A block producer validates each transaction before it is [submitted to a block](https://docs.cardano.org/new-to-cardano/cardano-nodes). The sender must have sufficient funds, so there is no double-spending, and all the nodes across the ledger must reach consensus.
A block producer validates each transaction before it is
[submitted to a block](https://docs.cardano.org/new-to-cardano/cardano-nodes).
The sender must have sufficient funds, so there is no double-spending, and all
the nodes across the ledger must reach consensus.

Let’s take a closer look at how this worked within the Shelley ledger and how Plutus scripts change this process to support multi-asset transactions and smart contracts.
Let’s take a closer look at how this worked within the Shelley ledger and how
Plutus scripts change this process to support multi-asset transactions and smart
contracts.

### Transaction validation using Shelley native scripts

Cardano operates based on the unspent transaction output (UTXO) accounting model. This process means it uses transaction inputs and outputs as records to track fund transfers, ownership, and balances. Users’ funds are stored as unspent transaction outputs, each of which has a quantity that can be spent. Inputs are unspent outputs from previous transactions. As soon as an output is used as input in a transaction, it becomes spent and can never be used again. The output is specified by:
Cardano operates based on the unspent transaction output (UTXO) accounting
model. This process means it uses transaction inputs and outputs as records to
track fund transfers, ownership, and balances. Users’ funds are stored as
unspent transaction outputs, each of which has a quantity that can be spent.
Inputs are unspent outputs from previous transactions. As soon as an output is
used as input in a transaction, it becomes spent and can never be used again.
The output is specified by:

- **an address**: that contains a payment credential and an optional stake credential, either a public/verification key hash or a script hash. Technically, the stake credential can also be a pointer to the registration certificate.
- **a value**: reflects the actual ada amount that can be spent.
- **an address**: that contains a payment credential and an optional stake
credential, either a public/verification key hash or a script hash.
Technically, the stake credential can also be a pointer to the registration
certificate.
- **a value**: reflects the actual ada amount that can be spent.

A transaction must be signed by the owner of the private key (also referred to as the signing key), which corresponds to the payment credential included in the address.
A transaction must be signed by the owner of the private key (also referred to
as the signing key), which corresponds to the payment credential included in the
address.

Cardano Shelley supported ada transactions solely. However, the Shelley formal specification introduced the concept of [multi-signature (multisig) scripts](https://github.com/input-output-hk/cardano-node/blob/master/doc/reference/simple-scripts.md#multi-signature-scripts), which, native by their nature, are captured entirely by ledger rules. This multisig scheme allowed an unspent transaction output to be used as an input to a new transaction if a predefined combination of signatures was provided. For example, if two individuals have to sign the transaction simultaneously, two out of three keys have to be provided, etc.
Cardano Shelley supported ada transactions solely. However, the Shelley formal
specification introduced the concept of
[multi-signature (multisig) scripts](https://github.com/input-output-hk/cardano-node/blob/master/doc/reference/simple-scripts.md#multi-signature-scripts),
which, native by their nature, are captured entirely by ledger rules. This
multisig scheme allowed an unspent transaction output to be used as an input to
a new transaction if a predefined combination of signatures was provided. For
example, if two individuals have to sign the transaction simultaneously, two out
of three keys have to be provided, etc.

Multisig is a very simple language, and it allows working with such four constructors as `RequireSignature`, `RequireAllOf`, `RequireAnyOf`, and `RequireMOf`. However, as more functionality is added to the ledger, scripts should be extended to support additional terms for expressing a range of other conditions.
Multisig is a very simple language, and it allows working with such four
constructors as `RequireSignature`, `RequireAllOf`, `RequireAnyOf`, and
`RequireMOf`. However, as more functionality is added to the ledger, scripts
should be extended to support additional terms for expressing a range of other
conditions.

### Upgrading multisig to Plutus Core

With the introduction of [multi-asset support](https://docs.cardano.org/native-tokens/learn) and smart contracts on Cardano, extending the basic multisig scripting language with more advanced options is essential. Having integrated Alonzo rules into the ledger (which signifies the addition of smart contract capabilities to Cardano), we have added the necessary tools and infrastructure, as well as support for a new scripting language – Plutus Core.
With the introduction of
[multi-asset support](https://docs.cardano.org/native-tokens/learn) and smart
contracts on Cardano, extending the basic multisig scripting language with more
advanced options is essential. Having integrated Alonzo rules into the ledger
(which signifies the addition of smart contract capabilities to Cardano), we
have added the necessary tools and infrastructure, as well as support for a new
scripting language – Plutus Core.

To upgrade multisig to Plutus Core, the Alonzo ledger implements the [extended unspent transaction output (EUTXO) accounting model](https://iohk.io/en/blog/posts/2021/03/12/cardanos-extended-utxo-accounting-model-part-2/), using Plutus Core to provide powerful scripting capabilities.
To upgrade multisig to Plutus Core, the Alonzo ledger implements the
[extended unspent transaction output (EUTXO) accounting model](https://iohk.io/en/blog/posts/2021/03/12/cardanos-extended-utxo-accounting-model-part-2/),
using Plutus Core to provide powerful scripting capabilities.

EUTXO extends the UTXO model by allowing output addresses to contain complex logic to decide which transactions can be used to unlock them and by adding custom data to all outputs. To achieve this, scripts require a definite, well-specified scripting language, and data should be attached to outputs, which will be passed to the script during execution. Plutus Core enables such complex script execution by nodes during transaction validation while ‘live’ on the chain. They will either lock UTXOs in the form of validator scripts, or as minting policies, which control the minting and burning of native tokens. Redeemer data is then specified as a simple (algebraic) data type that can be defined easily in Haskell. In practice, a smart contract developer will write validator scripts in Haskell, which will then be automatically compiled into Plutus Core.
EUTXO extends the UTXO model by allowing output addresses to contain complex
logic to decide which transactions can be used to unlock them and by adding
custom data to all outputs. To achieve this, scripts require a definite,
well-specified scripting language, and data should be attached to outputs, which
will be passed to the script during execution. Plutus Core enables such complex
script execution by nodes during transaction validation while ‘live’ on the
chain. They will either lock UTXOs in the form of validator scripts, or as
minting policies, which control the minting and burning of native tokens.
Redeemer data is then specified as a simple (algebraic) data type that can be
defined easily in Haskell. In practice, a smart contract developer will write
validator scripts in Haskell, which will then be automatically compiled into
Plutus Core.

Appropriate Haskell libraries simplify writing such validation logic by providing core data types for the inspection of transactions during validation. These also offer many helper functions and higher-level abstractions, allowing contract authors to concentrate on business logic without worrying about too many low-level details.
Appropriate Haskell libraries simplify writing such validation logic by
providing core data types for the inspection of transactions during validation.
These also offer many helper functions and higher-level abstractions, allowing
contract authors to concentrate on business logic without worrying about too
many low-level details.
2 changes: 1 addition & 1 deletion content/11-community/05-getting-support.mdx
Expand Up @@ -18,7 +18,7 @@ You can reach the developers in the Cardano community using these:
- [Cardano Forums](https://forum.cardano.org/c/developers/)
- [Stack Exchange](https://cardano.stackexchange.com/)
- Telegram:
- [Group for Development queries](https://t.me/CardanoDevelopers)
- [Group for Development queries](https://t.me/CardanoDevelopersOfficial)
- [Group for Stake Pool Operation queries](https://t.me/CardanoStakePoolWorkgroup).

# Where can I get technical support?
Expand Down
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 402a7be

Please sign in to comment.