# Teal version mismatch

**URL:** <https://forum.algorand.co/t/teal-version-mismatch/3145>\
**Category:** Uncategorized\
**Tags:** testnet, teal\
**Created:** [May 2, 2021, 9:50am UTC](https://forum.algorand.co/t/teal-version-mismatch/3145 "2021-05-02T09:50:45Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![pagito](https://avatars.discourse-cdn.com/v4/letter/p/3ec8ea/32.png) [@pagito](https://forum.algorand.co/u/pagito)\
**Post date:** [May 2, 2021, 9:50am UTC](https://forum.algorand.co/t/teal-version-mismatch/3145/1 "2021-05-02T09:50:45Z")

</div>

Hi everyone,

I’m writing my very first SC in algorand. Started with Teal3, since it has some new opcodes and global vars, but I got “version mismatch” error when debugging… Then, I switched to Teal2. But still, the same problem occurs when I try to debug the code.

Simple stateful Smart Contract in Teal2, which saves app creator:

```nohighlight
#pragma version 2
int 0
txn ApplicationID
== //
bz not_creation
byte "Creator"
txn Sender
app_global_put
int 1
return
bz failed
not_creation:
byte "Creator"
app_global_get
txn Sender
== //
bz failed
int 1 
return
failed:
int 0 
return

```

Command creating the app: `goal app create --creator <ACCOUNT> --approval-prog ./creator2.teal --global-byteslices 1 --global-ints 2 --local-byteslices 3 --local-ints 4 --clear-prog ./clear.teal --out=dump2.dr --dryrun-dump`

Debug command: `tealdbg debug creator2.teal -d dump2.dr`

Results:

```nohighlight
Debug error: 11 errors:
1: version mismatch: assembling v2 with v0 assembler
4: field ApplicationID available in version 2. Missed #pragma version?
5: == arg 0 wanted type any got None
6: bz opcode was introduced in TEAL v2
9: app_global_put opcode was introduced in TEAL v2
11: return opcode was introduced in TEAL v2
12: bz opcode was introduced in TEAL v2
15: app_global_get opcode was introduced in TEAL v2
18: bz opcode was introduced in TEAL v2
20: return opcode was introduced in TEAL v2
23: return opcode was introduced in TEAL v2

```

If I run creator SC for Teal3 ([https://github.com/algorand/smart-contracts/blob/master/devrel/teal3/creator.teal](https://github.com/algorand/smart-contracts/blob/master/devrel/teal3/creator.teal)), then I get this:

```nohighlight
    Debug error: 16 errors:
1: version mismatch: assembling v3 with v0 assembler
4: field ApplicationID available in version 2. Missed #pragma version?
5: == arg 0 wanted type any got None
6: bz opcode was introduced in TEAL v2
9: app_global_put opcode was introduced in TEAL v2
11: field GlobalNumUint available in version 3. Missed #pragma version?
14: field GlobalNumByteSlice available in version 3. Missed #pragma version?
17: && arg 0 wanted type uint64 got []byte
18: field LocalNumUint available in version 3. Missed #pragma version?
22: field LocalNumByteSlice available in version 3. Missed #pragma version?
25: && arg 0 wanted type uint64 got None
26: bz opcode was introduced in TEAL v2
31: global CreatorAddress available in version 3. Missed #pragma version?
33: bz opcode was introduced in TEAL v2
35: return opcode was introduced in TEAL v2
38: return opcode was introduced in TEAL v2

```

I guess the problem for both is that my algo node environment works for Teal V1. How do I change that, any ideas?

Thanks in advance!

---

<div class="post-metadata">

**Author:** ![fabrice](https://avatars.discourse-cdn.com/v4/letter/f/5fc32e/32.png) [@fabrice](https://forum.algorand.co/u/fabrice)\
**Post date:** [May 2, 2021, 6:30pm UTC](https://forum.algorand.co/t/teal-version-mismatch/3145/2 "2021-05-02T18:30:21Z")

</div>

Which version of `goal` are you using?  
Can you run `goal version -v` and `goal node status`?

PS: I’ve edited your post and change the simple backquote to triple backquotes to format the text better.

---

<div class="post-metadata">

**Author:** ![pagito](https://avatars.discourse-cdn.com/v4/letter/p/3ec8ea/32.png) [@pagito](https://forum.algorand.co/u/pagito)\
**Post date:** [May 3, 2021, 2:22am UTC](https://forum.algorand.co/t/teal-version-mismatch/3145/3 "2021-05-03T02:22:43Z")

</div>

Hey,

```
goal version -v

```

Version: [v1 v2]  
GenesisID: testnet-v1.0  
Build: 2.5.5.stable [rel/stable] (commit #304815d0)

```
goal node status

```

Last committed block: 1907274  
Time since last block: 3.8s  
Sync Time: 64648.1s  
Round for next consensus protocol: 1907275  
Next consensus protocol supported: true  
Last Catchpoint:  
Genesis ID: testnet-v1.0  
Genesis hash: SGO1GKSzyE7IEPItTxCByw9x8FmnrCDexi9/cOUJOiI=

The machine is Ubuntu 20.04.2. I followed docs “Run a node”, which installed mainnet network and then I switched to testnet by replacing genesys file…

P.S. Thanks for editing, so triple backquote was what I needed. 🙂

---

<div class="post-metadata">

**Author:** ![pagito](https://avatars.discourse-cdn.com/v4/letter/p/3ec8ea/32.png) [@pagito](https://forum.algorand.co/u/pagito)\
**Post date:** [May 3, 2021, 3:59am UTC](https://forum.algorand.co/t/teal-version-mismatch/3145/4 "2021-05-03T03:59:09Z")

</div>

I have a different scenario with a sandbox on a Windows machine.

```
goal version -v

```

Version: [v1 v2]  
GenesisID: sandnet-v1  
Build: 2.5.5.stable [rel/stable] (commit #304815d0)

```
goal node status

```

Round for next consensus protocol: 2641  
Next consensus protocol supported: true  
Last Catchpoint:  
Genesis ID: sandnet-v1  
Genesis hash: 2nnIGT/c+wuwSeR+NAPXDV/XkJCBnrxf8ccR9xlRXfg=

If I debug Teal V2 program: `tealdbg debug creator2.teal`  
Erorr: ` Debug error: 1 error: 1: version mismatch: assembling v2 with v3 assembler`

From my understanding Teal is compiled with V3 in this case… Even though the goal version says v1, v2. (on both, ubuntu machine and sandbox).

How do I control this? I haven’t run goal version individually. It is running with tandem algod.

---

<div class="post-metadata">

**Author:** ![pagito](https://avatars.discourse-cdn.com/v4/letter/p/3ec8ea/32.png) [@pagito](https://forum.algorand.co/u/pagito)\
**Post date:** [May 3, 2021, 4:25am UTC](https://forum.algorand.co/t/teal-version-mismatch/3145/5 "2021-05-03T04:25:55Z")

</div>

Can anyone explain why my posts were flagged and became hidden? I removed the links from the Goal command responses if that was the reason…

---

<div class="post-metadata">

**Author:** ![fabrice](https://avatars.discourse-cdn.com/v4/letter/f/5fc32e/32.png) [@fabrice](https://forum.algorand.co/u/fabrice)\
**Post date:** [May 3, 2021, 1:21pm UTC](https://forum.algorand.co/t/teal-version-mismatch/3145/6 "2021-05-03T13:21:17Z")

</div>

The spam detection system got a bit overzealous…

Regarding your problem, it is possible (but I may be wrong) that `tealdbg` only supports the latest TEAL version, that is TEAL v3.  
Just switch to `#pragma version 3`.

It is safe to switch from TEAL v2 to TEAL v3 without changing the code.  
**Note that it is not safe to switch from TEAL v1 to TEAL v2.**

---

<div class="post-metadata">

**Author:** ![pagito](https://avatars.discourse-cdn.com/v4/letter/p/3ec8ea/32.png) [@pagito](https://forum.algorand.co/u/pagito)\
**Post date:** [May 3, 2021, 4:53pm UTC](https://forum.algorand.co/t/teal-version-mismatch/3145/7 "2021-05-03T16:53:33Z")

</div>

This time it worked. Not sure what was the problem exactly, cuz I tried V3 with approval program. Could be the fix was adding `#pragma version 3` to clear program as well. Anyway, thanks for help!

The reason I started debugging this example, is different error I am getting from SDK when sending transaction to the network. Shall I post it here or open a new post for it?

---

<div class="post-metadata">

**Author:** ![fabrice](https://avatars.discourse-cdn.com/v4/letter/f/5fc32e/32.png) [@fabrice](https://forum.algorand.co/u/fabrice)\
**Post date:** [May 3, 2021, 7:03pm UTC](https://forum.algorand.co/t/teal-version-mismatch/3145/8 "2021-05-03T19:03:28Z")

</div>

Yes, you may need both the approval and the clear program to be in version 3.

Please create a new post for the other error.
