Does the account of your public key has balance on your chain?
Yes, I have 2 AE in account of my public key.
Is your code open source somewhere? I can’t reproduce the issue so it is hard to help
My project is not an open source project. I’m developing it for a company.
I want to use a proxy. Because i need catch to requests. Can I do set proxy for HTTP requests in Universal?
You can’t set a proxy using the sdk natively. But you can use nginx or some reverse proxy for your node
Hello @philipp.chain
There is no error in the Universal
configuration. await ae.height();
I can get a return in the code. But when I use the spend method with the following parameters I get an error.
Universal Config
let universalConfig = {
"url": "http://mynodeurl:3013",
"internalUrl": "http://mynodeurl:3013",
"keypair": {
"publicKey": "ak_2EDJ3nquU5M5B9j9uAFhbcrRhnr9bwiXQQRPxXp8wpwCEvv1BC",
"secretKey": "MY_SECRET"
},
"networkId": "ae_mainnet",
"nativeMode": true
}
Create Universal
const ae = await Universal(universalConfig);
Reduce Amount Decimal
let amount = 2 * Math.pow(10,18);
Spend TX
let txID = await ae.spend(amount, "ak_2P3bibGaHGj8tGxrPFqZefnoDe1qeiPE9BoJGcoajbRPzkaWAu");
I get the following error in ae.spend… line.
Error: While calling getTransactionByHash (hash), GET to http://mynodeurl:3013/v2/transactions/th_auRdGMsK7CoNZjyHsYpsbTNaCFmz9cu1B5qs19rdi2vLUpRUo failed with 404: Transaction not found
at Object.<anonymous> (/projectDirectory/node_modules/@aeternity/aepp-sdk/dist/webpack:/Ae/es/chain/node.js:33:1)
at arg (/projectDirectory/node_modules/@aeternity/aepp-sdk/dist/webpack:/Ae/node_modules/regenerator-runtime/runtime.js:293:1)
at Generator.arg [as _invoke] (/projectDirectory/node_modules/@aeternity/aepp-sdk/dist/webpack:/Ae/node_modules/regenerator-runtime/runtime.js:263:1)
at Generator.t.(anonymous function) [as throw] (/projectDirectory/node_modules/@aeternity/aepp-sdk/dist/webpack:/Ae/node_modules/regenerator-runtime/runtime.js:95:1)
at exports (/projectDirectory/node_modules/@aeternity/aepp-sdk/dist/webpack:/Ae/node_modules/@babel/runtime/regenerator/index.js:1:1)
at fn (/projectDirectory/node_modules/@aeternity/aepp-sdk/dist/webpack:/Ae/node_modules/@babel/runtime/helpers/asyncToGenerator.js:22:1)
at process._tickCallback (internal/process/next_tick.js:68:7
I’ve tried the Spend method many times.Every time I tried it asked the same tx_id (th_auRdGMsK7CoNZjyHsYpsbTNaCFmz9cu1B5qs19rdi2vLUpRUo) to my node. And it got 404 error on each of them. I can’t debug the code because your source code is compressed.
Anybody have any ideas?
I did ping the js-sdk team to have another look at this, sorry for the inconvenience and thanks for your patience.
Thank you. I’m waiting for your JS-SDK team’s answer.
your code seems correct to me and works flawlessly for me.
i quickly created the below scripts by copy pasting your lines and it works in first attempt
let universalConfig = {
"url": "https://sdk-testnet.aepps.com",
"internalUrl": "https://sdk-testnet.aepps.com",
"keypair": {
"publicKey": "ak_inbCC5iUZVehvcFHohoEYv9QMKSpLfmdDqXrch1e8b59sAEvk",
"secretKey": "402fa8a3d1939687bc6d34265fb1b983d0bb1c935efc0e28dcbd8abe53e779035ee15a5905555e914f16f2ffdbe811751703673784aa976cc612c76d03b37347"
},
"networkId": "ae_uat",
"nativeMode": true
}
async function createTxSpend(){
const ae = await Universal(universalConfig)
let amount = 2 * Math.pow(10, 18)
const result = await ae.spend(amount, "ak_2P3bibGaHGj8tGxrPFqZefnoDe1qeiPE9BoJGcoajbRPzkaWAu")
console.log(result)
}
createTxSpend()
see the 2 txs that i created using it: https://testnet.mdw.aepps.com/account/transactions/ak_inbCC5iUZVehvcFHohoEYv9QMKSpLfmdDqXrch1e8b59sAEvk
@sistemkoin-mahsum
Hmmm. strange
Can you provide more details.
- Node.js & SDK version you’re using
- aeternity node version
- aeternity config yaml
NodeJS Version: 10.16.3
aeternity node version: 3.2.0
aeternity config:
[
{ kernel,
[
{inet_dist_use_interface, {127,0,0,1}}
]
},
{ aehttp, [
{external, [
{acceptors, 10},
{port, 3013}
]},
{internal, [
{acceptors, 10},
{port, 3113}
]},
{channel, [
{websocket, [ {port, 3014},
{handlers, 100},
{listen_address, <<"127.0.0.1">>}
]}
]}
]},
{jobs, [
{auto_restore, true},
{samplers, [
{<<"mempool.size">>, aec_sampler_tx_pool, []}
]}
]},
{aecore, [
{peers, []},
{mainnet_peers, [
<<"aenode://pp_2L8A5vSjnkLtfFNpJNgP9HbmGLD7ZAGFxoof47N8L4yyLAyyMi@18.136.37.63:3015">>,
<<"aenode://pp_2gPZjuPnJnTVEbrB9Qgv7f4MdhM4Jh6PD22mB2iBA1g7FRvHTk@52.220.198.72:3015">>,
<<"aenode://[email protected]:3015">>,
<<"aenode://pp_2mwr9ikcyUDUWTeTQqdu8WJeQs845nYPPqjafjcGcRWUx4p85P@3.17.30.101:3015">>,
<<"aenode://pp_2CAJwwmM2ZVBHYFB6na1M17roQNuRi98k6WPFcoBMfUXvsezVU@13.58.177.66:3015">>,
<<"aenode://pp_vxK2ikV9djG8MXmDnYYs338ETEsaUPweZrc2S54L3scxBfncU@13.250.190.66:3015">>,
<<"aenode://pp_28si4QQ4YkjpZdo5cER7nxQodT2cMv7uNLBzUmaTkfU7EVHFH9@34.218.57.207:3015">>,
<<"aenode://[email protected]:3015">>,
<<"aenode://pp_H4ooofyixJE6weqsgzKMKTdjZwEWb2BMSWqdFqbwZjssvtUEZ@18.217.69.24:3015">>,
<<"aenode://pp_2qPAV7cYcHBK8MDo7neB2p1ow5Bmu1o56EUtnVv19ytuZ3pTtX@3.0.217.255:3015">>,
<<"aenode://pp_2eu9njAqnd2s9nfSHNCHMbw96dajSATz1rgT6PokH2Lsa531Sp@3.17.15.122:3015">>,
<<"aenode://[email protected]:3015">>,
<<"aenode://pp_21DNLkjdBuoN7EajkK3ePfRMHbyMkhcuW5rJYBQsXNPDtu3v9n@35.166.231.86:3015">>,
<<"aenode://pp_RKVZjm7UKPLGvyKWqVZN1pXN6CTCxfmYz2HkNL2xiAhLVd2ho@52.11.110.179:3015">>,
<<"aenode://pp_AnPnGst52qzh7ii8KUzHHFwFGiXxyF2TALhds9LPguAxJJqKd@54.214.159.45:3015">>,
<<"aenode://pp_2u68ui39npbsjDVAy7Q1vBYFxfgaV3AWbXL8UB38TuKsgehHF1@52.88.74.110:3015">>,
<<"aenode://[email protected]:3015">>,
<<"aenode://pp_Xv6KMd1612pLWznW37s2fx79QMHGbLZuXTyFvuXRrHSNb8s5o@18.218.172.119:3015">>,
<<"aenode://pp_XpZVMtsbg39Rm69aBP3m2Q245ght8MNUGN1omBr7xJmd4goxR@52.40.117.141:3015">>,
<<"aenode://pp_21fv4vH2GbmL35gb6tWhwFQjMnprftuGQ4Xx97VehSM8eQdB7U@34.211.251.83:3015">>,
<<"aenode://pp_sGegC48UrvDA7cvvUU3GPTze9wNUnnK1P4q46mL5jAFddNrbD@13.250.144.60:3015">>,
<<"aenode://pp_cVrCJWsg2vyWnRerEpLyB6ut6A8AA1MchQWAheRFNWpRWHXHJ@35.163.118.175:3015">>,
<<"aenode://[email protected]:3015">>,
<<"aenode://pp_2aAEHdDFNbqH23HdZqu6HMtQmaE6rvLQuDZqEEWndkNbWunyuY@18.216.167.138:3015">>,
<<"aenode://pp_2R7a7JHzfZQU5Ta7DJnFiqRr7ayCcAVakqYzJ2mvZj5k4ms5mV@3.17.15.239:3015">>,
<<"aenode://[email protected]:3015">>,
<<"aenode://pp_8nn6ypcwkaXxJfPGq7DCpBpf9FNfmkXPvGCjJFnLzvwjhCMEH@52.26.157.37:3015">>,
<<"aenode://[email protected]:3015">>,
<<"aenode://pp_QkNjQbJL3Ab1TVG5GesKuZTixBdXEutUtxG677mVu9D4mMNRr@13.228.202.140:3015">>,
<<"aenode://pp_2jtDgarjfr7S5NBZpBBx3fgn3wdtLb24UmiYGtVCGzF6x7Bytb@52.77.168.79:3015">>,
<<"aenode://pp_7N7dkCbg39MYzQv3vCrmjVNfy6QkoVmJe3VtiZ3HRncvTWAAX@13.53.114.199:3015">>,
<<"aenode://pp_22FndjTkMMXZ5gunCTUyeMPbgoL53smqpM4m1Jz5fVuJmPXm24@13.53.149.181:3015">>,
<<"aenode://pp_Xgsqi4hYAjXn9BmrU4DXWT7jURy2GoBPmrHfiCoDVd3UPQYcU@13.53.164.121:3015">>,
<<"aenode://[email protected]:3015">>,
<<"aenode://pp_2LnQXCmGqEJymtHAeUGjgcXU7dPLBbsut9rAXDG3nb7sCQK4fN@13.53.213.137:3015">>,
<<"aenode://pp_22fVESEbuKNaQWNTWH45PLH7tazAKHev4PCdKBmuVgU1BC7mKu@13.53.51.175:3015">>,
<<"aenode://pp_2HjB1wZrAubYUCH3jfosMaWV9ZVq6GP3PKAG8CVfQPxKwFcLsw@13.53.161.210:3015">>,
<<"aenode://pp_2QPVSDntnXzVpcjhAiiWCsXbP5WyAof9erGP4Wr47F8dVY9Nwy@13.53.162.212:3015">>,
<<"aenode://pp_NPrJPXfzBU8da5Ufy2o2LmyHXhLX733NPHER2Xh3cTcbK2BDD@13.53.78.163:3015">>,
<<"aenode://pp_27VNp1gHQQsNa2hBPB7na6CUCtvobqAe7sQmPKBW4G3v6uEq9s@13.53.89.32:3015">>
]},
{testnet_peers, [
<<"aenode://pp_QU9CvhAQH56a2kA15tCnWPRJ2srMJW8ZmfbbFTAy7eG4o16Bf@52.10.46.160:3015">>,
<<"aenode://pp_2vhFb3HtHd1S7ynbpbFnEdph1tnDXFSfu4NGtq46S2eM5HCdbC@18.195.109.60:3015">>,
<<"aenode://pp_27xmgQ4N1E3QwHyoutLtZsHW5DSW4zneQJ3CxT5JbUejxtFuAu@13.250.162.250:3015">>,
<<"aenode://pp_2i8N6XsjCGe1wkdMhDRs7t7xzijrjJDN4xA22RoNGCgt6ay9QB@31.13.249.70:3015">>
]},
{peer_password, <<"secret">>},
{aec_mining, {29, [{<<"mean29-generic">>, <<"-t 1">>, false, 1, undefined, <<"aecuckoo">>}]}}
]
},
{lager, [
{error_logger_flush_queue, false},
{handlers, [
{lager_console_backend, [{level, info}]},
{lager_file_backend,
[{file, "log/aeternity.log"}, {level, debug},
{size, 4194303}, {date, "$D0"}, {count, 10}]}
]},
{extra_sinks, [
{epoch_mining_lager_event, [
{handlers, [
{lager_file_backend, [
{file, "log/aeternity_mining.log"},
{level, info},
{size, 4194303}, {date, "$D0"}, {count, 3}
]}
]}
]},
{epoch_metrics_lager_event, [
{handlers, [
{lager_file_backend, [
{file, "log/aeternity_metrics.log"},
{level, info},
{size, 4194303}, {date, "$D0"}, {count, 3},
{formatter, lager_default_formatter},
{formatter_config, [time, " ", message, "\n"]}
]}
]}
]},
{aeminer_lager_event, [
{handlers, [
{lager_file_backend, [
{file, "log/aeternity_pow_cuckoo.log"},
{level, debug},
{size, 4194303}, {date, "$D0"}, {count, 3}
]}
]}
]},
{epoch_sync_lager_event, [
{handlers, [
{lager_console_backend, [{level, info}]},
{lager_file_backend, [
{file, "log/aeternity_sync.log"}, {level, debug},
{size, 4194303}, {date, "$D0"}, {count, 3}
]}
]}
]}
]}
]},
{sasl, [
{sasl_error_logger, false}
]},
{mnesia, [{dir, "data/mnesia"}]},
{setup, [
{abort_on_error, true},
{data_dir, "data"},
{log_dir, "log"}
]}
].
also the sdk version that you’re using please.
@sistemkoin-mahsum
i tried running a node(ae_uat) with your config and everything works for me.
i can not really say currently why it is not working for you.
i will try to dig more when i have more time.
Does it work for you if you use one of the hosted API nodes? So is it clearly an issue of your self-hosted node? Would you share your node publicly here?
Edit: i would like to invite you do https://devchat.aeternity.com after you sign up i will activate your login.