Contract Not Found error using state cmd

Why is the state cmd reporting a Contract Not Found error?
[email protected]:~/go/src/github.com/tokenized/smart-contract$ source ./conf/service-envs/covid19greenlight_cli.dev.env
[email protected]:~/go/src/github.com/tokenized/smart-contract$ go run cmd/smartcontract/main.go state 1QAinrbEfjv46jdpwZcqc1nB4tWH9AE8in
2020/09/19 07:36:26.882324 [Main] bootstrap.go:56 Info - Config : {
“Contract”: {
“PrivateKey”: “”,
“OperatorName”: “”,
“Version”: “”,
“FeeAddress”: “”,
“FeeRate”: 1,
“DustLimit”: 546,
“RequestTimeout”: 60000000000,
“PreprocessThreads”: 4,
“IsTest”: true
},
“Bitcoin”: {
“Network”: “mainnet”
},
“SpyNode”: {
“Address”: “127.0.0.1:8333”,
“UserAgent”: “/Tokenized:0.1.0/”,
“StartHash”: “”,
“UntrustedNodes”: 25,
“SafeTxDelay”: 2000,
“ShotgunCount”: 100
},
“RpcNode”: {
“Host”: “”,
“Username”: “”,
“Password”: “”
},
“AWS”: {
“AWS_REGION”: “ap-southeast-2”,
“AWS_ACCESS_KEY_ID”: “”,
“AWS_SECRET_ACCESS_KEY”: “”
},
“NodeStorage”: {
“Bucket”: “standalone”,
“Root”: “./tmp”
},
“Storage”: {
“Bucket”: “standalone”,
“Root”: “./tmp”
}
}
Error: Contract not found
Usage:
smartcontract state [flags]

I also tried using convert first:
go run ./cmd/smartcontract/main.go convert 1QAinrbEfjv46jdpwZcqc1nB4tWH9AE8in
[email protected]:~/go/src/github.com/tokenized/smart-contract$ go run ./cmd/smartcontract/main.go convert 1QAinrbEfjv46jdpwZcqc1nB4tWH9AE8in
Hex : fe21858f92f463ea1175535045c047ff3776ed67
[email protected]:~/go/src/github.com/tokenized/smart-contract$
[email protected]:~/go/src/github.com/tokenized/smart-contract$ go run ./cmd/smartcontract/main.go state 20fe21858f92f463ea1175535045c047ff3776ed67
2020/09/20 13:35:57.128158 [Main] bootstrap.go:56 Info - Config : {
“Contract”: {
“PrivateKey”: “”,
“OperatorName”: “”,
“Version”: “”,
“FeeAddress”: “”,
“FeeRate”: 1,
“DustLimit”: 546,
“RequestTimeout”: 60000000000,
“PreprocessThreads”: 4,
“IsTest”: true
},
“Bitcoin”: {
“Network”: “mainnet”
},
“SpyNode”: {
“Address”: “127.0.0.1:8333”,
“UserAgent”: “/Tokenized:0.1.0/”,
“StartHash”: “”,
“UntrustedNodes”: 25,
“SafeTxDelay”: 2000,
“ShotgunCount”: 100
},
“RpcNode”: {
“Host”: “”,
“Username”: “”,
“Password”: “”
},
“AWS”: {
“AWS_REGION”: “ap-southeast-2”,
“AWS_ACCESS_KEY_ID”: “”,
“AWS_SECRET_ACCESS_KEY”: “”
},
“NodeStorage”: {
“Bucket”: “standalone”,
“Root”: “./tmp”
},
“Storage”: {
“Bucket”: “standalone”,
“Root”: “./tmp”
}
}
Error: Address has bad checksum
Usage:
smartcontract state [flags]

I have lots of evidence that this Contract Address is good:
https://whatsonchain.com/address/1QAinrbEfjv46jdpwZcqc1nB4tWH9AE8in finds this contract is valid!

And it looks like the sync command finds the contract:

[email protected]:~/go/src/github.com/tokenized/smart-contract$

smartcontract_sync_2020-09-18_02-10-33.log

2020/09/18 02:10:34.302751 [Main] wallet.go:155 Info - Loaded unspent output 0.00004317 : 48f8a5d81d0cb386abdf8d6d50b01332179e867b05288d44de66aeae88f72a8e:0

2020/09/18 02:10:34.302799 [Main] wallet.go:155 Info - Loaded unspent output 0.00077717 : 996248da1e381de87e8303eae3ee6818848f3513a97bdccb06bf7caae01c3d61:2

2020/09/18 02:10:34.302807 [Main] wallet.go:161 Info - Loaded wallet with 9 outputs, 2 unspent, and balance of 0.00082034

2020/09/18 02:10:34.302817 [Main] wallet.go:164 Info - Wallet address : 16GgqN2sWSTZAZobNkR6uLVUUmD8LnnSPM

2020/09/18 02:10:34.302826 [Main] node.go:114 Info - Contract address : 1QAinrbEfjv46jdpwZcqc1nB4tWH9AE8in

2020/09/18 02:10:34.312878 [SpyNode] peers.go:94 Verbose - Loaded 23872 peers

2020/09/18 02:10:35.537536 [SpyNode] node.go:112 Info - Loaded blocks to height 653055

2020/09/18 02:10:35.537551 [SpyNode] node.go:116 Info - Start block height 560000

2020/09/18 02:10:35.537558 [SpyNode] transactions.go:45 Verbose - lypka No unconfirmed txs to load

2020/09/18 02:10:35.537568 [SpyNode] node.go:151 Verbose - Connecting to 127.0.0.1:8333

2020/09/18 02:10:35.538487 [SpyNode] node.go:862 Info - Safe tx delay : 10 ms

2020/09/18 02:10:35.538512 [SpyNode] version.go:31 Verbose - (127.0.0.1:8333) Version : /Bitcoin SV:1.0.1/ protocol 70015, blocks 653055

2020/09/18 02:10:35.538594 [SpyNode] node.go:707 Verbose - ReadMessage : Unknown Command : protoconf

2020/09/18 02:10:35.538888 [SpyNode] headers.go:57 Info - Headers in sync at height 653055

2020/09/18 02:10:35.538907 [SpyNode] headers.go:64 Info - Blocks in sync at height 653055

2020/09/18 02:10:35.765837 [Main] node.go:380 Info - No new blocks found

2020/09/18 02:10:35.765859 [Main] node.go:384 Info - Balance : 0.00082034

2020/09/18 02:10:35.765871 [Main] node.go:169 Info - Stopping

2020/09/18 02:10:35.765876 [SpyNode] node.go:277 Verbose - Requesting stop

2020/09/18 02:10:35.765881 [SpyNode] node.go:284 Info - Stopping

2020/09/18 02:10:35.765956 [SpyNode] node.go:710 Warn - ReadMessage : read tcp 127.0.0.1:44176->127.0.0.1:8333: use of closed network connection

2020/09/18 02:10:36.538402 [SpyNode] node.go:1072 Verbose - Waiting for 0 untrusted nodes to finish

2020/09/18 02:10:36.538430 [SpyNode] node.go:225 Verbose - Saving

2020/09/18 02:10:36.538551 [SpyNode] transactions.go:80 Verbose - Saving 0 unconfirmed txs

2020/09/18 02:10:36.538564 [SpyNode] peers.go:202 Verbose - Saving 23872 peers

2020/09/18 02:10:36.542226 [SpyNode] node.go:140 Verbose - Stopped

2020/09/18 02:10:36.567335 [Main] wallet.go:180 Info - Saved wallet with 9 outputs and balance of 0.00082034


AND I ran a successful T1 Share Transfer using this contract address so it must be good:

2020/09/19 10:37:50.183742 [Main] wallet.go:155 Info - Loaded unspent output 0.00004317 : 48f8a5d81d0cb386abdf8d6d50b01332179e867b05288d44de66aeae88f72a8e:0
2020/09/19 10:37:50.183791 [Main] wallet.go:155 Info - Loaded unspent output 0.00077717 : 996248da1e381de87e8303eae3ee6818848f3513a97bdccb06bf7caae01c3d61:2
2020/09/19 10:37:50.183799 [Main] wallet.go:161 Info - Loaded wallet with 9 outputs, 2 unspent, and balance of 0.00082034
2020/09/19 10:37:50.183811 [Main] wallet.go:164 Info - Wallet address : 16GgqN2sWSTZAZobNkR6uLVUUmD8LnnSPM
2020/09/19 10:37:50.183821 [Main] node.go:114 Info - Contract address : 1QAinrbEfjv46jdpwZcqc1nB4tWH9AE8in
Response estimated : 397 bytes, 2092 funding
TxId: 81fc925438f67da7cecad1b2828f47dd49ff316498e914ce9755436331a6f52e
Version: 1
Inputs:

Outpoint: 0 - 48f8a5d81d0cb386abdf8d6d50b01332179e867b05288d44de66aeae88f72a8e
Script: 473044022015eb274f995f672fcb861934306d3c8bbf41ca7b2077c8891e321f2d6fe5255c02206c51fd538b7e17b0f188353be0ca5076be0be7f554a94eeef7eed5d50fabfafc412103f767629f8c0b29e116242d1baa8a905029b8388ff487564c534b9119ed9ca4d3
Sequence: ffffffff
Address: 16GgqN2sWSTZAZobNkR6uLVUUmD8LnnSPM

Outpoint: 2 - 996248da1e381de87e8303eae3ee6818848f3513a97bdccb06bf7caae01c3d61
Script: 483045022100f192beb1a616671bf5ed51d76a17e8ecfa544d205d26ed0bdfa78eb9eb817cc902207fb536b7e1877a01a046396487e198a5355ee530a9a6dbdddf1829e38e403f36412103f767629f8c0b29e116242d1baa8a905029b8388ff487564c534b9119ed9ca4d3
Sequence: ffffffff
Address: 16GgqN2sWSTZAZobNkR6uLVUUmD8LnnSPM

Outputs:

Value: 0.00005028
Script: 76a914fe21858f92f463ea1175535045c047ff3776ed6788ac
Address: 1QAinrbEfjv46jdpwZcqc1nB4tWH9AE8in

Value: 0.00000000
Script: 006a02bd000e746573742e746f6b656e697a6564041a025431480a4612035348431a20bbf16c62ed650553330329f2db623bdb740f58d1bae21e6af3bf0e314e523d06220210012a190a1520c7bd4b65fb23514e3d80373b9828fdf13f01c90d1001

Value: 0.00076525
Script: 76a91439d01eb5a9aa39ff4ad9e4c5d931382f8793fd6988ac
Address: 16GgqN2sWSTZAZobNkR6uLVUUmD8LnnSPM

LockTime: 0

Action : T1
{
“Assets”: [
{
“AssetType”: “SHC”,
“AssetCode”: “bbf16c62ed650553330329f2db623bdb740f58d1bae21e6af3bf0e314e523d06”,
“AssetSenders”: [
{
“Quantity”: 1
}
],
“AssetReceivers”: [
{
“Address”: “20c7bd4b65fb23514e3d80373b9828fdf13f01c90d”,
“Quantity”: 1
}
]
}
]
}
Sending to network
2020/09/19 10:37:50.184455 [SpyNode] node.go:405 Info - Shotgunning tx : 81fc925438f67da7cecad1b2828f47dd49ff316498e914ce9755436331a6f52e
.
.
2020/09/19 10:38:06.854436 [SpyNode] node.go:442 Verbose - Waiting for 250 untrusted nodes to finish\n
2020/09/19 10:38:07.851981 [SpyNode] peers.go:202 Verbose - Saving 25938
peers\ncontract_item_filepath =
/home/dlypka/go/src/github.com/tokenized/smart-contract/covid19greenlight/action_json_files/wbuffet_13f4SpiGcvPa2ko6noeTj8fFKTJ8M2So6f_transfer.json\n
action = T1\nstdout_smartcontract_build = CompletedProcess(args=[’/home/dlypka/go/src/github.com/tokenized/smart-contract/runsmartcontract_build.sh’, ‘/home/dlypka/go/src/github.com/tokenized/smart-contract/conf/service-envs/covid19greenlight_cli.dev.env’, ‘T1’, ‘/home/dlypka/go/src/github.com/tokenized/smart-contract/covid19greenlight/action_json_files/wbuffet_13f4SpiGcvPa2ko6noeTj8fFKTJ8M2So6f_transfer.json’, ‘–tx --send’, ‘/home/dlypka/go/src/github.com/tokenized/smart-contract/covid19greenlight/logs/smartcontract_build_T1_send_2020-09-19_10-37-46.log’], returncode=0, stdout=’’, stderr=’’)’
** No Errors! Successful Transfer! **

The CLI state command only works for contract addresses being run locally (or that you have access to the smart contract agent storage). Make sure the storage path for the CLI is the same as for the smart contract agent for the contract address you are querying when you run that command.

I believe they are aligned:
In dev.env I have:
export BITCOIN_CHAIN=mainnet

export NODE_ADDRESS=127.0.0.1:8333
export NODE_USER_AGENT="/Tokenized:0.1.0/"

export START_HASH=“0000000000000000035cb1baaf4f82d8358a8b9ed22aec52c2801a02b9c6f18f”
export NODE_STORAGE_ROOT=./tmp/contract
export NODE_STORAGE_BUCKET=standalone

Where to store contract state. This example would store files in the ~/tmp/standalone directory.
export CONTRACT_STORAGE_ROOT=./tmp/contract
export CONTRACT_STORAGE_BUCKET=standalone


in cli.dev.env I have:

export CLIENT_NODE_ADDRESS=127.0.0.1:8333
export CLIENT_NODE_USER_AGENT="/TokenizedClient:0.1.0/"

Where to store state files
export CLIENT_PATH=./tmp/client

export BITCOIN_CHAIN=mainnet


Does this look OK?

These values need to match in dev.env and cli.dev.env. Then you should be okay.

export CONTRACT_STORAGE_ROOT=./tmp/contract
export CONTRACT_STORAGE_BUCKET=standalone