Credit : EveryBlock.Studio
This will reclaim the 2 ADA deposit
cardano-cli query utxo --address $(cat payment.addr) --allegra-era --testnet-magic 1097911063
cardano-cli shelley query protocol-parameters \ --testnet-magic 1097911063 \ --allegra-era \ --out-file protocol.json cardano-cli shelley stake-address deregistration-certificate \ --stake-verification-key-file stake.vkey \ --out-file destake.cert cardano-cli shelley transaction build-raw \ --tx-in 6ac2a8ea2a8f949e22539ed405961e0bce409e461bcb752b3baaed9b3e06971f#0 \ --tx-out $(cat payment.addr)+0 \ --ttl 0 \ --fee 0 \ --out-file tx.raw \ --certificate-file destake.cert cardano-cli shelley transaction calculate-min-fee \ --tx-body-file tx.raw \ --tx-in-count 1 \ --tx-out-count 1 \ --witness-count 1 \ --byron-witness-count 0 \ --testnet-magic 1097911063 \ --protocol-params-file protocol.json fee: 172761 2896701265 - 172761 + 2000000 = 2898528504 currentSlot=$(cardano-cli query tip --testnet-magic 1097911063 | jq -r '.slotNo') echo Current Slot: $currentSlot cardano-cli shelley transaction build-raw \ --tx-in 6ac2a8ea2a8f949e22539ed405961e0bce409e461bcb752b3baaed9b3e06971f#0 \ --tx-out $(cat payment.addr)+2898528504 \ --ttl $(($currentSlot+1000)) \ --fee 172761 \ --out-file tx.raw \ --certificate-file destake.cert cardano-cli shelley transaction sign \ --tx-body-file tx.raw \ --signing-key-file payment.skey \ --signing-key-file stake.skey \ --testnet-magic 1097911063 \ --out-file tx.signed cardano-cli shelley transaction submit \ --tx-file tx.signed \ --testnet-magic 1097911063
White paper: 3.10.2 Deposits
version: '3' services: jenkins: image: koolwith/cardano-node user: root:root restart: always container_name: cardano-node1 environment: TZ: "Asia/Kolkata" volumes: - /opt//cardano-my-node:/root/cardano-my-node ports: - 6000:6000
docker build -t cardano-node -f cardano-node.Dockerfile .
FROM debian:stable-slim as base RUN apt-get update -y RUN apt-get install git jq bc make rsync htop curl build-essential pkg-config libffi-dev libgmp-dev libssl-dev libtinfo-dev libsystemd-dev zlib1g-dev make g++ wget libncursesw5 libtool autoconf -y RUN mkdir $HOME/git \ && cd $HOME/git \ && git clone https://github.com/input-output-hk/libsodium \ && cd libsodium \ && git checkout 66f017f1 \ && ./autogen.sh \ && ./configure \ && make \ && make install RUN cd \ && wget https://downloads.haskell.org/~cabal/cabal-install-188.8.131.52/cabal-install-184.108.40.206-x86_64-unknown-linux.tar.xz \ && tar -xf cabal-install-220.127.116.11-x86_64-unknown-linux.tar.xz \ && rm cabal-install-18.104.22.168-x86_64-unknown-linux.tar.xz cabal.sig \ && mkdir -p $HOME/.local/bin \ && mv cabal $HOME/.local/bin/ RUN wget https://downloads.haskell.org/ghc/8.10.2/ghc-8.10.2-x86_64-deb9-linux.tar.xz \ && tar -xf ghc-8.10.2-x86_64-deb9-linux.tar.xz \ && rm ghc-8.10.2-x86_64-deb9-linux.tar.xz \ && cd ghc-8.10.2 \ && ./configure \ && make install RUN echo PATH="$HOME/.local/bin:$PATH" >> $HOME/.bashrc \ && echo export LD_LIBRARY_PATH="/usr/local/lib:$LD_LIBRARY_PATH" >> $HOME/.bashrc \ && echo export NODE_HOME=$HOME/cardano-my-node >> $HOME/.bashrc \ && echo export NODE_CONFIG=mainnet>> $HOME/.bashrc \ && echo export NODE_BUILD_NUM="$(curl https://hydra.iohk.io/job/Cardano/iohk-nix/cardano-deployment/latest-finished/download/1/index.html | grep -e "build" | sed 's/.*build\/\([0-9]*\)\/download.*/\1/g')" >> $HOME/.bashrc \ && /bin/bash -c "source $HOME/.bashrc" \ && mv $HOME/.local/bin/* /usr/local/bin/ RUN cabal update RUN cd $HOME/git \ && git clone https://github.com/input-output-hk/cardano-node.git \ && cd cardano-node \ && git fetch --all --recurse-submodules --tags \ && git checkout tags/1.24.2 RUN cd $HOME/git/cardano-node \ && export LD_LIBRARY_PATH="/usr/local/lib:$LD_LIBRARY_PATH" \ && export PKG_CONFIG_PATH="/usr/local/lib/pkgconfig:$PKG_CONFIG_PATH" \ && cabal configure -O0 -w ghc-8.10.2 \ && echo -e "package cardano-crypto-praos\n flags: -external-libsodium-vrf" > cabal.project.local \ && sed -i $HOME/.cabal/config -e "s/overwrite-policy:/overwrite-policy: always/g" \ && rm -rf $HOME/git/cardano-node/dist-newstyle/build/x86_64-linux/ghc-8.10.2 \ && cabal build cardano-cli cardano-node \ && cp $(find $HOME/git/cardano-node/dist-newstyle/build -type f -name "cardano-cli") /usr/local/bin/cardano-cli \ && cp $(find $HOME/git/cardano-node/dist-newstyle/build -type f -name "cardano-node") /usr/local/bin/cardano-node
This article is copy of https://www.beaver-stake-pool.net/post/what-does-a-cardano-stake-pool-do
Simple put, a Cardano Stake Pool is a participant in the Proof-of-Stake consensus algorithm, Ouroboros.
During the Shelley phase, the Cardano network utilizes Ouroboros Praos. A stake pool’s main functions are:
- Forge new blocks
- Verify new blocks
- Confirm transactions
Figure 1 below illustrates the general steps that a stake pool goes through to create a block.
Figure 1: How a Stake Pool Forges Blocks
- At every slot, which is every second, the stake pool uses the Verified Random Function (VRF) to check if it is the slot leader. The function takes the slot ID, Nonce, and VRF signing key as inputs to generate a random output value. If the output value is less than the threshold, which is determined by the stake pool’s relative stake, then you are crowned the slot leader for this particular slot. The higher the pool’s stake, the higher probability that the stake pool becomes the slot leader.
- If a stake pool is assigned as leader, it signs a new block using the Key Evolving Signature (KES) signing key, along with the computed VRF output and proof, and transactions waiting for confirmation by the network.
- This stake pool’s new block is then broadcasted to other nodes to the network.
Since a stake pool is checking for slot leadership every second, it is imperative that stake pools have 100% up-time to ensure they don’t miss being elected slot leader.
The Nonce value used in the VRF is used as a seeding value for random number generation. It is created by hashing the first 2/3s of the VRF outputs from the previous epoch’s blocks.
If a stake pool is not forging blocks, it still plays a role by verifying blocks and confirming transactions. Figure 2 illustrates how blocks are verified while the stake pool is waiting to be a slot leader.
Figure 2: How a stake pool verifies incoming blocks
- The stake pool uses the VRF to check for slot leadership every slot.
- A new block is received from our connected peers.
- The stake pool verifies the block’s VRF proof using the VRF verification (public) key from the corresponding stake pool that signed the block. If it is valid, it gets added to the local block chain.
An interesting property of Ouroboros Praos is that each stake pool independently tries to determine whether or not they are the slot leader with the VRF. The slot leadership schedule is not known in advance and pools will only know who a slot leader was when a block is received and verified.
This also means that two or more stake pools could determine themselves as the slot leader for a single slot. This is what’s called a slot battle. Slot battles are now resolved by the VRF. Whichever block has a lower VRF output value is determined to be the winner of that slot.
The cardano-node code developed by IOHK performs all these actions after a stake pool owner has configured the program to operate for their own pool(s).
For more details on Ouroboros Praos:
- Eurocrypt 2018: Ouroboros Praos https://eurocrypt.iacr.org/2018/Slides/Tuesday/TrackA/01-03.pdf
- Ouroboros Praos: An adaptively-secure, semi-synchronous proof-of-stake blockchain https://eprint.iacr.org/2017/573.pdf