TON Dev Chat
X
is like a type argument of a generic type Message
, where X
is defined by you (contains the data you want it to contain), and Message
is a type that represents a TON message
https://tonapi.io/v1/blockchain/getTransactions?limit=1
{
"transactions": [
{
"account": {
"address": "-1:5555555555555555555555555555555555555555555555555555555555555555",
"icon": "",
"is_scam": false,
"name": "Config Contract"
},
"data": "b5ee9c720102060100012c0003af7555555555555555555555555555555555555555555555555555555555555555500001e0bb00b3cc32267db19dc0a356287439563e06c305051f759be49f0faa717068359598cad3f00001e0baffbfa83637b4e240001408010203000120008272b7038a9be500e4253a6c515935a3cc39aa86aa08f606ba5da9d49f16a44d3b5a20a09a6e696768172f39c30c6f89afabe4e723f557cc36ac595ebcbedd9491b30205303024040500a041297004c4b40000000000000000002e00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000005bc00000000000000000000000012d452da449e50b8cf7dd27861f146122afe1b546bb8b70fc8216f0c614139f8e04",
"fee": 0,
"hash": "507adb0af90024e61ed527399d3bbcab321bf45151b60d4c6853164ee227a9d5",
"lt": 33035547000003,
"other_fee": 0,
"out_msgs": [],
"storage_fee": 0,
"utime": 1669025316
}
]
}
for example see this transaction address is "5555555555555555555555555555555555555555555555555555555555555555" -1:5555555555555555555555555555555555555555555555555555555555555555
https://app.tonkeeper.com/v1/txrequest-url/fragment.com/tonkeeper/rawRequest?id=vXTgLackpr5EH-BNtorkKhrG
kQDvmaMWs3-cDCvTizDWLjsz_IdEVA7JymnfsKTNE3OAp4jJ
in_msg
or out_msgs
. Config contract contains global config variables of the blockchain.
out_msgs
. This can be obtained through ton-http-api.
<workchain>:<hex>
without the <> brackets
tonweb.Address(address)
LITE_SERVER_UNKNOWN: cannot apply external message to current state : Failed to unpack account state
keyPair
to seed? that i will import using tonweb.utils.keyPairFromSeed
?
3
last
command. It shows me that last block was for more than 2000 seconds ago.
Found existing deploy-wallet [ kQCjfVOocWPAEfHXG1MuGkVDNb2q2qI8p6HrZkawLkmyOZiV] (Balance: 0💎, Is inited: False)
and then after trying to send coins from https://t.me/@testgiver_ton_bot got this error : An error occurred, please contact with the administrator!
Could anyone help ?
te6ccgEBBAEA5wADrUY3KJrpcF4P-kuLh24Nwo9FtC4edLDciSDuGrTh96kkc2nHs_VKvAdPc-Io1Lw-R2wAkBn64m0r4eAgosi8TmIW2mYDAAAAA2OHh2Jjh4f4BXBlbmlzwAECAwBaAWh0dHBzOi8vbmZ0LmZyYWdtZW50LmNvbS91c2VybmFtZS9wZW5pcy5qc29uAGOAGAUX7Ahh6mJrsavv5apyYYQi3sKCw7dHkQ_0DXCZchhsEjCc5UAAAKAAAcIAASdQEABLAAUAZIAIEbR2UW2Ay0snwgciTTdVU4vxldeBjTs-FVd1ZVMkrXA
tonweb.boc.Cell.oneFromBoc(tonweb.utils.base64ToBytes('')
{"version":"0","body":{"type":"sign-raw-payload","params":{"source":"EQCA14o1-VWhS2efqoh_9M1b_A9DtKTuoqfmkn83AbJzwnPi","valid_until":1669875028,"messages":[{"address":"EQCA14o1-VWhS2efqoh_9M1b_A9DtKTuoqfmkn83AbJzwnPi","amount":10000000000000,"payload":"te6ccgEBBAEA5wADrUY3KJo-0Uu8LR7qtft8VK7UXunmrlII6Ylxix7SwKdatsZkUNLLXj4J3HwXpfGatI1RncyKUH3OoaOJyo0AygCInYIBAAAAA2OIRApjiESgBXBlbmlzwAECAwBaAWh0dHBzOi8vbmZ0LmZyYWdtZW50LmNvbS91c2VybmFtZS9wZW5pcy5qc29uAGOAGAUX7Ahh6mJrsavv5apyYYQi3sKCw7dHkQ_0DXCZchhsEjCc5UAAAKAAAcIAASdQEABLAAUAZIAIEbR2UW2Ay0snwgciTTdVU4vxldeBjTs-FVd1ZVMkrXA"}]},"response_options":{"callback_url":"https:\/\/fragment.com\/tonkeeper\/rawResponse?id=YyL-8F_8nhGb6yvqY8v2dMa3&qr=1","return_url":"https:\/\/fragment.com\/tonkeeper\/rawResponse?id=YyL-8F_8nhGb6yvqY8v2dMa3","broadcast":true},"expires_sec":1669875028}}
toncli
on windows:ImportError: cannot import name 'BitString' from 'bitstring' (C:\Users\yuria\AppData\Local\Programs\Python\Python311\Lib\site-packages\bitstring.py)
bitstring
is installed
join group
it just close a window i have to back this chat(((
v2R1
, v2R2
, v3R1
, v3R2
, v4R1
, v4R2
?
mnemonic
> seed
> keyPair
but it should be mnemonic
> seed
> bip44-path + index
> keyPair
, all popular blockchains use this like bitcoin, eth, sol...
wallet ID
option, that allows you to generate multiple wallets from the same private key.
privateKey
? I saw in the Satoshi lab TON
with path number 607
is it right?
ed25519
by defualt 😌😌😌
tweetnacl
which uses in the library use 256 for derivetoncli
to one I have control?
main
wallet is risk for sure
metamask
version for TON
PS C:\Users\yuria\learning\TonFunClessons_Eng\1lesson\solution> toncli deploy -n mainnet
INFO: 🚀 You want to interact with your contracts ['contract'] in mainnet - that's great!
INFO: 🦘 Found existing deploy-wallet [kQB1zW2FVqWbFB0w4OR9HMw0-lgmt5oj34i1_Cbb3b_a1Vcm] (Balance: 0.495434999💎, Is inited: True) in C:\Users\yuria\AppData\Local\toncli\toncli
INFO: 👻 Your smart contract project [C:\Users\yuria\learning\TonFunClessons_Eng\1lesson\solution] is now going to be deployed, get ready!
INFO: 🌈 Start building:
INFO: 🌲 Func compiled
INFO: 🤗 Run tests on ['C:\\Users\\yuria\\learning\\TonFunClessons_Eng\\1lesson\\solution']
[ 1][t 0][2022-12-04 08:47:54.8228452][Fift.cpp:67] top: include
level 1: <text interpreter continuation>
[ 1][t 0][2022-12-04 08:47:54.8230493][fift-main.cpp:205] Error interpreting file `C:\Users\yuria\AppData\Local\Temp\tmpzped393q.fif`: tmpzped393q.fif:6: include:cannot locate file `C:\Users\yuria\learning\TonFunClessons_Eng\1lesson\solution`
INFO: 🌲 Tests passed
INFO: 🥳 Start contract manipulation
[ 1][t 0][2022-12-04 08:47:54.8530669][Fift.cpp:67] top: include
level 1: <text interpreter continuation>
[ 1][t 0][2022-12-04 08:47:54.8532668][fift-main.cpp:205] Error interpreting file `C:\Users\yuria\AppData\Local\Temp\tmpqod601oi.boc`: tmpqod601oi.boc:2: include:cannot locate file `C:\Users\yuria\learning\TonFunClessons_Eng\1lesson\solution`
Traceback (most recent call last):
File "<frozen runpy>", line 198, in _run_module_as_main
File "<frozen runpy>", line 88, in _run_code
File "C:\Users\yuria\AppData\Local\Programs\Python\Python311\Scripts\toncli.exe\__main__.py", line 7, in <module>
File "C:\Users\yuria\toncli\src\toncli\main.py", line 67, in main
CommandsExecuter(command, string_kwargs, parser)
File "C:\Users\yuria\toncli\src\toncli\modules\utils\commands\commands_executer.py", line 42, in __init__
self.command_mapper[command](self)
File "C:\Users\yuria\toncli\src\toncli\modules\utils\commands\commands_executer.py", line 73, in deploy_command
return DeployCommand(self.string_kwargs, self.parser)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\yuria\toncli\src\toncli\modules\utils\commands\command_classes\deploy_command.py", line 17, in __init__
deployer.publish(real_args[2:])
File "C:\Users\yuria\toncli\src\toncli\modules\deploy_contract.py", line 88, in publish
self.build(real_contracts)
File "C:\Users\yuria\toncli\src\toncli\modules\abstract\deployer.py", line 111, in build
data.append(contract_manipulation(os.path.abspath(contract.to_save_location),
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\yuria\toncli\src\toncli\modules\utils\fift\commands.py", line 96, in contract_manipulation
output = subprocess.check_output(command, cwd=getcwd() if not cwd else cwd)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\yuria\AppData\Local\Programs\Python\Python311\Lib\subprocess.py", line 465, in check_output
return run(*popenargs, stdout=PIPE, timeout=timeout, check=True,
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\yuria\AppData\Local\Programs\Python\Python311\Lib\subprocess.py", line 569, in run
raise CalledProcessError(retcode, process.args,
subprocess.CalledProcessError: Command '['C:\\Users\\yuria\\ton-win64-binaries\\fift.exe', '-I', 'C:\\Users\\yuria\\AppData\\Local\\toncli\\toncli\\fift-libs', '-s', 'C:\\Users\\yuria\\AppData\\Local\\Temp\\tmpqod601oi.boc', '']' returned non-zero exit status 2.
EQAV1sEMzJw06pwIFcGmvBZB3H4Bzk7uwOYfPBp5_Th7QWPf
0QDyt68zW_ngXlctCevWl0irCSwJ-wtWQC4ZHIbeKdCv15wg
2 TON
block.tlb
:)out_list_empty$_ = OutList 0;
out_list$_ {n:#} prev:^(OutList n) action:OutAction
= OutList (n + 1);
action_send_msg#0ec3c86d mode:(## 8)
out_msg:^(MessageRelaxed Any) = OutAction;
action_set_code#ad4de08e new_code:^Cell = OutAction;
action_reserve_currency#36e6b809 mode:(## 8)
currency:CurrencyCollection = OutAction;
libref_hash$0 lib_hash:bits256 = LibRef;
libref_ref$1 library:^Cell = LibRef;
action_change_library#26fa1dd4 mode:(## 7) { mode <= 2 }
libref:LibRef = OutAction;
out_list_node$_ prev:^Cell action:OutAction = OutListNode;
https://github.com/ton-defi-org/tonstarter-contracts
on ubuntunpm run build
, it says `FATAL ERROR: 'func' with version >= 0.2.0 executable is not found, is it installed and in path?> - create a bamboo-like tree of cells, where each of them have exactly 1 reference (except for the last one)Contracts have limited storage depth, so the array won't be able to have more than ~512 elements. https://ton.org/docs/learn/tvm-instructions/tvm_overview#result-of-tvm-execution
compileResult =
await compileFunc({
sources: {
"stdlib.fc": readFileSync('../func/stdlib.fc', { encoding: 'utf-8' }),
'main.fc': readFileSync('../func/main.fc', { encoding: 'utf-8' }),
},
entryPoints: ["stdlib.fc","main.fc"],
})
compact-u16
is a multi-byte encoding of 16 bits. The first byte contains the lower 7 bits of the value in its lower 7 bits. If the value is above 0x7f
, the high bit is set and the next 7 bits of the value are placed into the lower 7 bits of a second byte. If the value is above 0x3fff
, the high bit is set and the remaining 2 bits of the value are placed into the lower 2 bits of a third byte.hex | compact-u16
--------+------------
0x0000 | [0x00]
0x0001 | [0x01]
0x007f | [0x7f]
0x0080 | [0x80 0x01]
0x3fff | [0xff 0x7f]
0x4000 | [0x80 0x80 0x01]
0xc000 | [0x80 0x80 0x03]
0xffff | [0xff 0xff 0x03])
Presumably TL-B
schema like this:// compact-u16.tlbBut this is probably wrong. I will get an error on omit code generation and verbosity level
bool_false$0 = BoolFalse;
nothing$0 {X:Type} = Maybe X;
just$1 {X:Type} value:X = Maybe X;
tail#_ b:(bits 7) next:BoolFalse = CompactU16Snaked ~0;
cons#_ {n:#} b:(bits 7) next:(Maybe(CompactU16Snaked ~n)) = CompactU16Snaked ~(n + 1);
tlbc -qv compact-u16.tlb
compact-u16.tlb:6:37: error: passed an argument of incorrect polarity to `Maybe`
cons#_ {n:#} b:(bits 7) next:(Maybe(CompactU16Snaked ~n)) = CompactU16Snaked ~(n + 1);
How to describe the compact-u16
format to the TL-B
schema?
compileResult
там ошибка должна быть
{
status: 'error',
message: 'Func compilation error: main.fc:3:44: error: redefinition of function `recv_internal`\n' +
' () recv_internal(slice in_msg_body) impure {'
}
{
status: 'error',
message: 'Func compilation error: cannot generate code for function `recv_internal`:\n' +
'main.fc:6:26: error: variable does not have fixed width, cannot manipulate it\n' +
' slice ds = get_data().begin_parse();'
}
main.fc:11:48: error: undefined function `.end_cell`, defining a global function of unknown type
set_data(begin_cell().store_uint(total, 64).end_cell());
sources: () => readFileSync("../func/main.fc").toString()
sources: (path) => readFileSync(__dirname + '/' + path).toString()
global_var = ...;
and probably with operator assignemnts like +=, *= etc but it seems that right now you can't use modifying functions on global vars
global cell a;
() main(){
a = new_dict();
int x = 5;
cell msg = begin_cell().store_uint(0x10, 6).end_cell();
a = udict_set_ref(a, 32, x, msg);
}
that one compiles fine, but for some reason, this one won't:global cell a;
() main(){
a = new_dict();
int x = 5;
cell msg = begin_cell().store_uint(0x10, 6).end_cell();
a~udict_set_ref(32, x, msg);
}
Snake
string type or not?
root_cell("0x00000000" - 32 bit, "string" up to 123 bytes)
↳1st_ref("string continuation" up to 127 bytes)
↳1st_ref("string continuation" up to 127 bytes)
↳....
Check `ptr && "deferencing null Ref"` failed
what does this error mean guys?
ton-contract-executor
? Should I use bocToCell()
?
[ 1][t 1][2022-12-08 11:57:41.317123][lite-client.cpp:165][!testnode] fatal error executing command-line queries, skipping the rest
(int) math::mod (int x, int y) asm "MOD”;
math::mod(int x, int y)
const { compileContract } = require("ton-compiler");
const fs = require("fs");
(async () => {
let result = await compileContract({ files: ['counter.fc'], stdlib: true, version: 'latest' });
if (result.ok) {
console.log(result.fift); // Compiled Fift assembler
console.log(result.cell); // Compiled cell Buffer
} else {
console.warn(result.logs); // Output logs
}
})();
for sale
number you can buy without tonkeeper. te6ccgECBQEAARoABLlGNyibmVnFmqheUamvMdfWIC7-uqFkFD0k2iA05HJ-CH_SamsTw3DDg_SPm_H2XhVftF0NTOQuxymeZQAdiFeKaJboAgAAAAxjk3taY5N78As4ODgwMjQ2MTU3M-ABAgMEAGIBaHR0cHM6Ly9uZnQuZnJhZ21lbnQuY29tL251bWJlci84ODgwMjQ2MTU3My5qc29uAGuACBG0dlFtgMtLJ8IHIk03VVOL8ZXXgY07PhVXdWVTJK1qBDDiNACgQw4jQACgAAHCAAEnUBAASwAFAGSACBG0dlFtgMtLJ8IHIk03VVOL8ZXXgY07PhVXdWVTJK1wAEPADQI3rPgO9gUnvwzGpO45tZYhpv65B-VhYVPO8WySTv-0
in ton transaction using ton js library?
{"version":"0","body":{"type":"sign-raw-payload","params":{"valid_until":1670609904,"messages":[{"address":"EQAOQdwdw8kGftJCSFgOErM1mBjYPe4DBPq8-AhF6vr9si5N","amount":9000000000,"payload":"te6ccgECBQEAARoABLlGNyibmVnFmqheUamvMdfWIC7-uqFkFD0k2iA05HJ-CH_SamsTw3DDg_SPm_H2XhVftF0NTOQuxymeZQAdiFeKaJboAgAAAAxjk3taY5N78As4ODgwMjQ2MTU3M-ABAgMEAGIBaHR0cHM6Ly9uZnQuZnJhZ21lbnQuY29tL251bWJlci84ODgwMjQ2MTU3My5qc29uAGuACBG0dlFtgMtLJ8IHIk03VVOL8ZXXgY07PhVXdWVTJK1qBDDiNACgQw4jQACgAAHCAAEnUBAASwAFAGSACBG0dlFtgMtLJ8IHIk03VVOL8ZXXgY07PhVXdWVTJK1wAEPADQI3rPgO9gUnvwzGpO45tZYhpv65B-VhYVPO8WySTv-0"}],"response_options":{"callback_url":"https:\/\/fragment.com\/tonkeeper\/rawResponse?id=BUkffmawEhmx2Uboh2NWuMiD&qr=1","broadcast":true},"expires_sec":1670609904}}
when tonkeeper scans qr code it gets this response from the fragment.
FIFTPATH
variable value absolute path to folder that contains fift executable