# Please help me to deploy smart contract on testnet

**URL:** <https://forum.cardano.org/t/please-help-me-to-deploy-smart-contract-on-testnet/102135>\
**Category:** Smart Contracts\
**Tags:** plutus\
**Created:** [30 May 2022 11:22 UTC](https://forum.cardano.org/t/please-help-me-to-deploy-smart-contract-on-testnet/102135 "2022-05-30T11:22:43Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![bluesky0812](https://sea1.discourse-cdn.com/flex023/user_avatar/forum.cardano.org/bluesky0812/32/54731_2.png) [@bluesky0812](https://forum.cardano.org/u/bluesky0812)\
**Post date:** [30 May 2022 11:22 UTC](https://forum.cardano.org/t/please-help-me-to-deploy-smart-contract-on-testnet/102135/1 "2022-05-30T11:22:43Z")

</div>

Now I am learning Haskell & Plutus to write smart contract.  
I can cost for your help to learn cardano smart contract.  
So I am trying to compile & deploy on testnet with this project.

> **[GitHub - jpg-store/contract-v2](https://github.com/jpg-store/contract-v2)**
>
> Contribute to jpg-store/contract-v2 development by creating an account on GitHub.

I had installed all environments on my Ubuntu & MacOS.

> > The Glorious Glasgow Haskell Compilation System, version 8.10.7  
> > cabal-install version 3.6.2.0  
> > compiled using version 3.6.2.0 of the Cabal library  
> > cardano-node 1.29.0 - linux-x86\_64 - ghc-8.10  
> > git rev 4c59442958072657812c6c0bb8e0b4ab85ce1ba2  
> > cardano-cli 1.29.0 - linux-x86\_64 - ghc-8.10  
> > git rev 4c59442958072657812c6c0bb8e0b4ab85ce1ba2  
> > nix (Nix) 2.8.0

> > cardano-wallet version  
> > v2022-04-27 (git revision: 0000000000000000000000000000000000000000)  
> > Installed Daedalus wallet

At first I command on terminal this cmd.  
export CARDANO\_NODE\_SOCKET\_PATH=$HOME/Cardano/db/node.socket  
and run cardano-node on my local. After it I command cabal run integration-tests.

> > Up to date  
> > {  
> > “epoch”: 8,  
> > “hash”: “48d8e744b97ff9c1288555640c839162f4e986d11a1f3d11d4457c0b50bd24b3”,  
> > “slot”: 178977,  
> > “block”: 177935,  
> > “era”: “Byron”,  
> > “syncProgress”: “3.98”  
> > }  
> > wrote NFT validator to file /tmp/swap3575763-0.plutus  
> > wrote NFT validator to file /tmp/alwaysSucceeds3575763-1.plutus  
> > Plutus script address: addr\_test1wz5d96c7agqnynvpll2ytpssm7tgl05a8vfnzngpg5dr00gss36pg  
> > Plutus script address: addr\_test1wrxydyy3ps4rh5amg3p2gnjhacwglensysu9c5pulyallls7q0zwm  
> > Command failed: query protocol-parameters Error: This query cannot be used for the Byron era  
> > integration-tests: callProcess: cardano-cli “query” “protocol-parameters” “–out-file” “/tmp/protocol-params3575763-2.json” “–testnet-magic” “1097911063” (exit 1): failed

export CARDANO\_NODE\_SOCKET\_PATH=/home/bluesky/.local/share/Daedalus/testnet/cardano-node.socket

> > Up to date  
> > {  
> > “epoch”: 208,  
> > “hash”: “5ed55cbf6fd25d869671418370f2a24541872d9b8025b267b723d40b0c0abec8”,  
> > “slot”: 59540218,  
> > “block”: 3591914,  
> > “era”: “Alonzo”,  
> > “syncProgress”: “100.00”  
> > }  
> > wrote NFT validator to file /tmp/swap3577493-0.plutus  
> > wrote NFT validator to file /tmp/alwaysSucceeds3577493-1.plutus  
> > Plutus script address: addr\_test1wz5d96c7agqnynvpll2ytpssm7tgl05a8vfnzngpg5dr00gss36pg  
> > Plutus script address: addr\_test1wrxydyy3ps4rh5amg3p2gnjhacwglensysu9c5pulyallls7q0zwm  
> > single offer  
> > can be purchased FAILED [1]  
> > can be cancelled by owner FAILED [2]  
> > buyer counter offers  
> > seller can accept offer FAILED [3]  
> > multiple offers  
> > from same seller  
> > can be cancelled in bulk FAILED [4]  
> > for same offer  
> > cannot be shorted FAILED [5]  
> > from multiple sellers  
> > that have no expiration  
> > cannot be cancelled in bulk FAILED [6]  
> > can be purchased in bulk FAILED [7]  
> > Can’t be purchased if another script is an input FAILED [8]  
> > Failures:  
> > integration-tests/Main.hs:129:7:
> > 
> > 1. single offer can be purchased  
> > uncaught exception: ErrorCall  
> > Prelude.foldl1: empty list  
> > To rerun use: --match “/single offer/can be purchased/”  
> > integration-tests/Main.hs:131:7:
> > 2. single offer can be cancelled by owner  
> > uncaught exception: ErrorCall  
> > Prelude.foldl1: empty list  
> > To rerun use: --match “/single offer/can be cancelled by owner/”  
> > integration-tests/Main.hs:135:11:
> > 3. single offer, buyer counter offers, seller can accept offer  
> > uncaught exception: ErrorCall  
> > Prelude.foldl1: empty list  
> > To rerun use: --match “/single offer/buyer counter offers/seller can accept offer/”  
> > integration-tests/Main.hs:141:9:
> > 4. multiple offers, from same seller, can be cancelled in bulk  
> > uncaught exception: ErrorCall  
> > Prelude.foldl1: empty list  
> > To rerun use: --match “/multiple offers/from same seller/can be cancelled in bulk/”  
> > integration-tests/Main.hs:146:11:
> > 5. multiple offers, from same seller, for same offer, cannot be shorted  
> > uncaught exception: ErrorCall  
> > Prelude.foldl1: empty list  
> > To rerun use: --match “/multiple offers/from same seller/for same offer/cannot be shorted/”  
> > integration-tests/Main.hs:182:11:
> > 6. multiple offers, from multiple sellers, that have no expiration, cannot be cancelled in bulk  
> > uncaught exception: ErrorCall  
> > Prelude.foldl1: empty list  
> > To rerun use: --match “/multiple offers/from multiple sellers/that have no expiration/cannot be cancelled in bulk/”  
> > integration-tests/Main.hs:185:11:
> > 7. multiple offers, from multiple sellers, that have no expiration, can be purchased in bulk  
> > uncaught exception: ErrorCall  
> > Prelude.foldl1: empty list  
> > To rerun use: --match “/multiple offers/from multiple sellers/that have no expiration/can be purchased in bulk/”  
> > integration-tests/Main.hs:188:11:
> > 8. multiple offers, from multiple sellers, that have no expiration, Can’t be purchased if another script is an input  
> > uncaught exception: ErrorCall  
> > Prelude.foldl1: empty list  
> > To rerun use: --match “/multiple offers/from multiple sellers/that have no expiration/Can’t be purchased if another script is an input/”  
> > Randomized with seed 1266991612  
> > Finished in 17.3217 seconds  
> > 8 examples, 8 failures

Please help me.  
skype : live:.cid.8c36cbfe88725f27  
telegram : [Telegram: Contact @programlucky](http://t.me/programlucky)

---

<div class="post-metadata">

**Author:** ![HeptaSean](https://sea1.discourse-cdn.com/flex023/user_avatar/forum.cardano.org/heptasean/32/82306_2.png) [@HeptaSean](https://forum.cardano.org/u/HeptaSean)\
**Post date:** [30 May 2022 12:12 UTC](https://forum.cardano.org/t/please-help-me-to-deploy-smart-contract-on-testnet/102135/2 "2022-05-30T12:12:41Z")

</div>

> [@bluesky0812](#):
>
> > cardano-node 1.29.0 - linux-x86\_64 - ghc-8.10  
> > git rev 4c59442958072657812c6c0bb8e0b4ab85ce1ba2
> 
> > cardano-cli 1.29.0 - linux-x86\_64 - ghc-8.10  
> > git rev 4c59442958072657812c6c0bb8e0b4ab85ce1ba2

These versions are quite ancient. Is there any reason, you did not install the latest versions?

> [@bluesky0812](#):
>
> At first I command on terminal this cmd.  
> export CARDANO\_NODE\_SOCKET\_PATH=$HOME/Cardano/db/node.socket  
> and run cardano-node on my local. After it I command cabal run integration-tests.
> 
> > > Up to date  
> > > {  
> > > […]  
> > > “era”: “Byron”,  
> > > “syncProgress”: “3.98”  
> > > }

You have tried to run the tests, before your node was fully synced. That cannot work. `syncProgress` has to be `"100.00"`, before the test would work.

> [@bluesky0812](#):
>
> export CARDANO\_NODE\_SOCKET\_PATH=/home/bluesky/.local/share/Daedalus/testnet/cardano-node.socket

Now, you are using a different node – the one inside Daedalus. Are you really running both in parallel on the same machine?

And did you also set the _other_ environment variables given in [https://github.com/jpg-store/contract-v2#running-the-tests](https://github.com/jpg-store/contract-v2#running-the-tests)?

---

<div class="post-metadata">

**Author:** ![bluesky0812](https://sea1.discourse-cdn.com/flex023/user_avatar/forum.cardano.org/bluesky0812/32/54731_2.png) [@bluesky0812](https://forum.cardano.org/u/bluesky0812)\
**Post date:** [30 May 2022 12:18 UTC](https://forum.cardano.org/t/please-help-me-to-deploy-smart-contract-on-testnet/102135/3 "2022-05-30T12:18:32Z")

</div>

Hi! @HeptaSean  
Thanks for you help.  
I will update my cardano-node & cardano-cli.  
And these are my envs.

> > export CARDANO\_NODE\_SOCKET\_PATH=/home/bluesky/.local/share/Daedalus/testnet/cardano-node.socket  
> > export CARDANO\_NODE\_SOCKET\_PATH=$HOME/Cardano/db/node.socket  
> > export SOURCE\_WALLET\_ADDRESS\_PATH=$HOME/Cardano/test-net/01.addr  
> > export SOURCE\_WALLET\_SKEY\_PATH=$HOME/Cardano/test-net/01.skey  
> > export TESTNET\_MAGIC=1097911063  
> > export WALLET\_DIR=$HOME/Cardano/test-net/wallet

I am using 2 nodes on my Ubuntu local, but I didn’t run them in parallel.

Thanks!!!🙂

---

<div class="post-metadata">

**Author:** ![bluesky0812](https://sea1.discourse-cdn.com/flex023/user_avatar/forum.cardano.org/bluesky0812/32/54731_2.png) [@bluesky0812](https://forum.cardano.org/u/bluesky0812)\
**Post date:** [30 May 2022 12:37 UTC](https://forum.cardano.org/t/please-help-me-to-deploy-smart-contract-on-testnet/102135/4 "2022-05-30T12:37:18Z")

</div>

Hi @HeptaSean  
Now I am updating my cardano-node & cardano-cli.  
It was required 8h to sync the Daedalus wallet.  
How long will it take to sync my cardano-node?  
If possible, I want to get long-term relation ship with you.

---

<div class="post-metadata">

**Author:** ![HeptaSean](https://sea1.discourse-cdn.com/flex023/user_avatar/forum.cardano.org/heptasean/32/82306_2.png) [@HeptaSean](https://forum.cardano.org/u/HeptaSean)\
**Post date:** [30 May 2022 13:52 UTC](https://forum.cardano.org/t/please-help-me-to-deploy-smart-contract-on-testnet/102135/5 "2022-05-30T13:52:57Z")

</div>

> [@bluesky0812](#):
>
> It was required 8h to sync the Daedalus wallet.  
> How long will it take to sync my cardano-node?

Since it is basically the same node running inside Daedalus, it will probably be in the same range.

For mainnet, it’s even worse. There, first sync can easily be several days.

> [@bluesky0812](#):
>
> And these are my envs.

Looks good (if you only uncomment one of the two settings for `CARDANO_NODE_SOCKET_PATH` at a time). And you have sourced that file, before trying to run the integration tests? And the wallets exist?

---

<div class="post-metadata">

**Author:** ![bluesky0812](https://sea1.discourse-cdn.com/flex023/user_avatar/forum.cardano.org/bluesky0812/32/54731_2.png) [@bluesky0812](https://forum.cardano.org/u/bluesky0812)\
**Post date:** [30 May 2022 16:36 UTC](https://forum.cardano.org/t/please-help-me-to-deploy-smart-contract-on-testnet/102135/6 "2022-05-30T16:36:26Z")

</div>

Hi @HeptaSean !  
You are right!  
It was already spent 4hrs, but the syncProgress is 47.79 yet.  
I am using this path.

> export CARDANO\_NODE\_SOCKET\_PATH=$HOME/Cardano/db/node.socket

Before trying to run the integration tests, I set up all envars and ran scripts/compile.sh.

> export WALLET\_DIR=$HOME/Cardano/test-net/wallet

In this path, there are 01.addr, 01.sky, 01.vkey files that created by followed query.

> cardano-cli address key-gen --verification-key-file 01.vkey --signing-key-file 01.skey  
> cardano-cli address build --payment-verification-key-file 01.vkey --testnet-magic 1097911063 --out-file 01.addr

If you are okay, I will resend msg after synchronizing.  
Thanks. 😃

---

<div class="post-metadata">

**Author:** ![bluesky0812](https://sea1.discourse-cdn.com/flex023/user_avatar/forum.cardano.org/bluesky0812/32/54731_2.png) [@bluesky0812](https://forum.cardano.org/u/bluesky0812)\
**Post date:** [31 May 2022 05:39 UTC](https://forum.cardano.org/t/please-help-me-to-deploy-smart-contract-on-testnet/102135/7 "2022-05-31T05:39:19Z")

</div>

Hi! My friend @HeptaSean  
How are you?

> export WALLET\_DIR=$HOME/Cardano/test-net/wallet

I deleted all files in this path, and commanded cabal run integration-tests.  
After that in the path the addr,skey, vkey files named buyer, seller1, seller2, marketplace, royalties had created.  
And the result was this.

> Up to date  
> {  
> “era”: “Alonzo”,  
> “syncProgress”: “100.00”,  
> “hash”: “914b152647655b5e7f85dbf26c8fba261e64da3567e644092e59e66ac80a3be8”,  
> “epoch”: 208,  
> “slot”: 59603859,  
> “block”: 3593710  
> }  
> wrote NFT validator to file /tmp/swap4038710-0.plutus  
> wrote NFT validator to file /tmp/alwaysSucceeds4038710-1.plutus  
> Plutus script address: addr\_test1wz5d96c7agqnynvpll2ytpssm7tgl05a8vfnzngpg5dr00gss36pg  
> Plutus script address: addr\_test1wrxydyy3ps4rh5amg3p2gnjhacwglensysu9c5pulyallls7q0zwm  
> single offer  
> can be purchased FAILED [1]  
> can be cancelled by owner FAILED [2]  
> buyer counter offers  
> seller can accept offer FAILED [3]  
> multiple offers  
> from same seller  
> can be cancelled in bulk FAILED [4]  
> for same offer  
> cannot be shorted FAILED [5]  
> from multiple sellers  
> that have no expiration  
> cannot be cancelled in bulk FAILED [6]  
> can be purchased in bulk FAILED [7]  
> Can’t be purchased if another script is an input FAILED [8]  
> Failures:  
> integration-tests/Main.hs:129:7:
> 
> 1. single offer can be purchased  
> uncaught exception: ErrorCall  
> Prelude.foldl1: empty list  
> To rerun use: --match “/single offer/can be purchased/”  
> …  
> …

I sent 100ADA to buyer.addr, but the result was same.  
I checked seller1.addr, seller2.addr, but there are not any NFTs.  
How can I fix this issues?  
And How can I set marketplace.addr?  
Please help me!  
Thanks.

---

<div class="post-metadata">

**Author:** ![bluesky0812](https://sea1.discourse-cdn.com/flex023/user_avatar/forum.cardano.org/bluesky0812/32/54731_2.png) [@bluesky0812](https://forum.cardano.org/u/bluesky0812)\
**Post date:** [31 May 2022 07:44 UTC](https://forum.cardano.org/t/please-help-me-to-deploy-smart-contract-on-testnet/102135/8 "2022-05-31T07:44:19Z")

</div>

👍 @HeptaSean  
I had resolved all issues, and all transactions are success.  
You were right. Cardano-node must be synchronized to testnet.  
After sync Progress was 100.00, all transactions were succeeded.  
Thanks!

---

<div class="post-metadata">

**Author:** ![Dawar\_Ejaz](https://sea1.discourse-cdn.com/flex023/user_avatar/forum.cardano.org/dawar_ejaz/32/70716_2.png) [@Dawar\_Ejaz](https://forum.cardano.org/u/Dawar_Ejaz)\
**Post date:** [6 October 2023 07:27 UTC](https://forum.cardano.org/t/please-help-me-to-deploy-smart-contract-on-testnet/102135/9 "2023-10-06T07:27:53Z")

</div>

Hi @HeptaSean @bluesky0812. i am working on implementing this contract at the moment.  
The problem i am facing is how to construct the datum and redeemer for all the cases.  
Plus when i try to run all the test using cardano-node 8.1.2 that is the latest version all the test fail because it has a dependency of node -v 1.35.1, So i am Running private testnet node to run all the tests.
