$ nix develop github:input-output-hk/marlowe-cardano
warning: Using saved setting for 'allow-import-from-derivation = true' from ~/.local/share/nix/trusted-settings.json.
warning: Using saved setting for 'extra-substituters = https://cache.iog.io https://cache.zw3rk.com' from ~/.local/share/nix/trusted-settings.json.
warning: Using saved setting for 'extra-trusted-public-keys = hydra.iohk.io:f/Ea+s+dFdN+3Y/G+FDgSq+a5NEWhJGzdjvKNGv0/EQ= loony-tools:pr9m4BkM/5/eSTZlkQyRt57Jz7OMBxNSUiMC4FkcNfk=' from ~/.local/share/nix/trusted-settings.json.
trace: warning: String 'configureFlags' is deprecated and will be removed in release 23.05. Please use a list of strings. Derivation name: libsodium-1.0.18, file: /nix/store/y97h970cpgbns44p4pq63ji17z0slcv5-source/overlays/crypto/libsodium.nix
trace: warning: `clade` nomenclature is deprecated.
There seems to be an old revision of `std` in the evaluation path,
likely in one of your flake inputs. Please inform downstream to
update their version of standard ASAP.
Agent pid 1595072
pre-commit-hooks.nix: updating /extra/iohk/marlowe-starter-kit repo
pre-commit installed at .git/hooks/pre-commit
pid 686355's current affinity list: 0-15
pid 686355's new affinity list: 0-15
warning: Using saved setting for 'extra-substituters = https://cache.zw3rk.com https://cache.iog.io https://hydra.iohk.io https://tweag-jupyter.cachix.org' from ~/.local/share/nix/trusted-settings.json.
warning: Using saved setting for 'extra-trusted-public-keys = loony-tools:pr9m4BkM/5/eSTZlkQyRt57Jz7OMBxNSUiMC4FkcNfk= hydra.iohk.io:f/Ea+s+dFdN+3Y/G+FDgSq+a5NEWhJGzdjvKNGv0/EQ= tweag-jupyter.cachix.org-1:UtNH4Zs6hVUFpFBTLaA4ejYavPo5EFFqgd7G7FxGW9g=' from ~/.local/share/nix/trusted-settings.json.
error: flake 'git+file:///extra/iohk/marlowe-starter-kit' does not provide attribute 'apps.x86_64-linux.refresh-compose', 'packages.x86_64-linux.refresh-compose', 'legacyPackages.x86_64-linux.refresh-compose' or 'refresh-compose'
We ignore the error message.
# The policy ID for the token.
POLICY_ID=b471f617a12ff5753f99d19dda675b8c1dc9f9172adca7297a938475
# The token name
TOKEN_NAME=Lender
# The UTxO with the token
TX_IN=70c633e63a04ac27b722fdef2f858a16cbcadf45ce6297e42b913c940e5fde40#0
# A pure-ada UTxO for collateral
TX_IN_COLLATERAL=576ea67dfb088648c1b8840d85f172e669824a83510f39b8bd9bdb56d5686db7#1
# A blockfrost API key
BLOCKFROST_API_KEY=<your blockfrost api keys goes here>
# The node socket
export CARDANO_NODE_SOCKET_PATH=node.socket
export CARDANO_TESTNET_MAGIC=1
# Credentials
PAYMENT_ADDR=addr_test1vq9prvx8ufwutkwxx9cmmuuajaqmjqwujqlp9d8pvg6gupczgtm9j
PAYMENT_SKEY=payment.skey
cat << EOI > convert.hs
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE PackageImports #-}
module Main where
import Cardano.Binary
import Data.String
import qualified "base16-bytestring" Data.ByteString.Base16 as BS16
main :: IO ()
main =
do
Right bytes <- BS16.decode . fromString <$> getContents
putStrLn
. ("{\"type\": \"PlutusScriptV2\", \"description\": \"\", \"cborHex\": " <>)
. (<> "}")
. show
. BS16.encode
. toStrictByteString
$ toCBOR bytes
EOI
CBOR=$(curl -sS -H "project_id: $BLOCKFROST_API_KEY" "https://cardano-preprod.blockfrost.io/api/v0/scripts/$POLICY_ID/cbor" | jq -r '.cbor')
echo -n $CBOR | runhaskell convert.hs > minting.plutus
cat << EOI > minting.redeemer
{"constructor": 1, "fields" : []}
EOI
cardano-cli query protocol-parameters --testnet-magic $CARDANO_TESTNET_MAGIC --out-file preprod.protocol
cardano-cli transaction build \
--testnet-magic $CARDANO_TESTNET_MAGIC \
--babbage-era \
--protocol-params-file preprod.protocol \
--tx-in $TX_IN \
--tx-in-collateral $TX_IN_COLLATERAL \
--mint "-1 $POLICY_ID.$(echo -n $TOKEN_NAME | basenc --base16)" \
--mint-script-file minting.plutus \
--mint-redeemer-file minting.redeemer \
--change-address $PAYMENT_ADDR \
--out-file tx.unsigned
Estimated transaction fee: Lovelace 371935
cardano-cli transaction sign \
--testnet-magic $CARDANO_TESTNET_MAGIC \
--tx-body-file tx.unsigned \
--signing-key-file $PAYMENT_SKEY \
--out-file tx.signed
cardano-cli transaction submit \
--testnet-magic $cARDANO_TESTNET_MAGIC \
--tx-file tx.signed
Transaction successfully submitted.