ProvableHQ / sdk

A Software Development Kit (SDK) for Zero-Knowledge Transactions
https://provable.tools
GNU General Public License v3.0
593 stars 471 forks source link

[Bug] offline error #929

Open loversmile opened 2 months ago

loversmile commented 2 months ago

🐛 Bug Report

when I run this template code https://github.com/AleoNet/sdk/tree/testnet-beta/create-aleo-app/template-offline-public-transaction-ts

it works ok when online, but when I disconnect the netwrok , it raise the error before. I have download the provider key before I close the network.

......... Proving the transfer execution wasm://wasm/01e2a6fa:1

RuntimeError: unreachable at wasm://wasm/01e2a6fa:wasm-function[2983]:0x6ef8ea at wasm://wasm/01e2a6fa:wasm-function[3698]:0x70dc22 at wasm://wasm/01e2a6fa:wasm-function[3504]:0x708499 at wasm://wasm/01e2a6fa:wasm-function[198]:0x1f8d4e at wasm://wasm/01e2a6fa:wasm-function[114]:0xb8acc at wasm://wasm/01e2a6fa:wasm-function[2493]:0x6b5c38 at wasm://wasm/01e2a6fa:wasm-function[1378]:0x60bb2b at wasm://wasm/01e2a6fa:wasm-function[3656]:0x70ce0b at wasm://wasm/01e2a6fa:wasm-function[225]:0x22b440 at wasm://wasm/01e2a6fa:wasm-function[508]:0x3b9466

Node.js v22.2.0

Steps to Reproduce

Code snippet to reproduce

# Add code here

Stack trace & error message

// Paste the output here

Expected Behavior

(Write what you expected to happen here)

Your Environment

zhp1254 commented 2 months ago

Hi, do you know how to sign the offline tx by private key?

loversmile commented 2 months ago

Hi, do you know how to sign the offline tx by private key?

use the buildTransferPublicTxOffline function, and use the privatekey like this

 const seedStr = "fa059434f92fe98a793d9123456789064f4b8661be07d03248ee7b1234567890";
    const seed = fromHexString(seedStr)

    const pKey = PrivateKey.from_seed_unchecked(seed);

    var account = new Account({
        privateKey: pKey.to_string()
    })
    programManager.setAccount(account);
zhp1254 commented 2 months ago

same error with me: Setup the program and inputs Transfer Type is: public Executing transfer function Loading program Loading function Inserting externally provided proving and verifying keys for credits.aleo - transfer_public Creating authorization parsing inputs Executing program Preparing the inclusion proof for the transfer execution Proving the transfer execution panicked at .cargo/git/checkouts/snarkvm-b1878b0251c7df5c/3d42aa0/parameters/src/mainnet/powers.rs:54:70: Failed to load powers of beta in universal SRS: Wasm("Download failed - XMLHttpRequest failed")

Stack:

Error at imports.wbg.__wbg_new_abda76e883ba8a5f (file:///./aleosdk/wasm/dist/testnet/index.js:4244:21) at wasm://wasm/01eda8f6:wasm-function[4179]:0x7423aa at wasm://wasm/01eda8f6:wasm-function[3080]:0x719485 at wasm://wasm/01eda8f6:wasm-function[3765]:0x739ff2 at wasm://wasm/01eda8f6:wasm-function[3593]:0x730dd2

zhp1254 commented 1 month ago

Hi, could help me please? we use [template-offline-public-transaction-ts](https://github.com/AleoNet/sdk/tree/testnet-beta/create-aleo-app/template-offline-public-transaction-ts) create transfer and broadcast to https://api.explorer.provable.com/v1/mainnet/transaction/broadcast, but it effect nothing without error

zhp1254 commented 1 month ago

Hi, could help me please? we use [template-offline-public-transaction-ts](https://github.com/AleoNet/sdk/tree/testnet-beta/create-aleo-app/template-offline-public-transaction-ts) create transfer and broadcast to https://api.explorer.provable.com/v1/mainnet/transaction/broadcast, but it effect nothing without error

curl -X POST -H 'Content-Type:application/json' "https://api.explorer.provable.com/v1/mainnet/transaction/broadcast" -d '{"type":"execute","id":"at1j6mzcagunjav9wnagxfmjjtckddvtjfpdys7klr43jvj6huyssyqzhr2d6","execution":{"transitions":[{"id":"au1agq4n0x3gtj66v823m7za6ht4kfc3sxr29969502c3e66eyxmy8su04vp6","program":"credits.aleo","function":"transfer_public","inputs":[{"type":"public","id":"4172028480459142836340269997709821363257236099316644421107795534598023294249field","value":"aleo1uelpp2m2de9mnfsx644ezurlnexc57p5t6d8dgd8uf6r80hevsrs7y8zd6"},{"type":"public","id":"3085670114672837127417828361261465587160208978301323273624359387370509618214field","value":"10000u64"}],"outputs":[{"type":"future","id":"643534095271329982581499724982466818879719211219056414023649912613218340267field","value":"{\n program_id: credits.aleo,\n function_name: transfer_public,\n arguments: [\n aleo1v4adjlsj3rjqqxdmup60lqxljgsl2nvckvfcewlgsq3cuu4ap5rq7t6xfh,\n aleo1uelpp2m2de9mnfsx644ezurlnexc57p5t6d8dgd8uf6r80hevsrs7y8zd6,\n 10000u64\n ]\n}"}],"tpk":"731059264866199702023389029258354726654968710864365652905817191511248625236group","tcm":"1683187200611992558420483029398301991697110249171145795003743594278396945713field","scm":"3746696264668536735593814573443293676476722228887478840873796329311937075679field"}],"global_state_root":"sr1hm2yjpzegf0me0t3wstmg5w0hrng50avq86ydq5c22ghzqcntyyswhxjcl","proof":"proof1qyqsqqqqqqqqqqqpqqqqqqqqqqq90hykuepghm8fhk3e82tw7z2gaux34shnngvevrft2c7nhn2cj09535f7y8r2xllkrhc5x5xwgfuqq9d9sqk4nlkkm8lujxuy4veegpc3t5mt36vuwfj2rnsjtm8luw4t0zcmjmj4s6cgesk0yry5a4vqxqx0mveqs4rp0fnvw9rc8n975s3q2cura6w5xs632turapqtxjg9tk2ddafwa23f9x4cdd4g3202v5qt29ajhy6u7gpsvjn300rsplce2k8yzc80z9e3hd77nuw4xdketujx82q0a4junvser49uhhzrcdqpv66ku4pz5f9uhqkd69cxdg843ek2fj346v08pc5s32d00hvhx2p8etv2enqs9ezw3ueax5vekjyqpag8mrmzez65ydmejlzqt7zye76vehjylg3athtku6k8txf2j5htzcn6qgl50s395e5yzxxp4unzsysfj4te4wjnmleqdxmqvn5mha2xrf4w7ew0r8yhs2s4z03g5kvg2ly8nd0mfqss6e9c63yevqft6qxlst2x82pc85cxn4pme2dykda252p9n44k60ugjud0mknwsdzyysq9t02emjszh2a7j4ljr0jsg7qc8s58hfd6q4quyhvwev6y40xgc28ecpl9k2vvft5mjn0xgd3dvp0wvyhu7sfsv2nzkq86fcnc5xgq54cntwzgjg3lc4nuu6jz7n7sv6qhtgj9mgcnatg34d2rlkwlrq93f2dguleka7mcfgcljz56zk7p9xccycry8srcmhpaqt6zan07uqncq7yv295ms369rphh0hy87vh2tj2mla9hre632k4tg0lfveazqzcnqtcz8yk33x5waqn3ctfa9ls4e8n0m8x4mxygjcjgtj069plsezv9920msc9yeunyeudu5s3vu8z528hx2pq2e4hv7wxj0p79q6qysx2y972jtl0gls6m6cqzst9lxepw78nzfaxq6p4xt9lrj05dnyf85hclc2p038tw0g0fwqarx9r7gd0k7n7r8gl8ssvrfce3lc3dcz0ezy3jg0cmyx7fq2gy3ldpcctmg26qjwkww6xyj0r9uw0ug2znplkw4z448jrnw3ezx0t0lj52ju0kt55zrr9qjfv56vu7jz24lvyqvpj69h56skqjpw4gj9pgzzncvq8qdavfmmaux2cfwsj69j40d3c8qvqqqqqqqqqqpqcm4kspnsr9trsxka4quene58j7std38axyuclh28jl7a5320x0mf0akgntksl4yq797gj8ldu7sqqvsr7gqayeafclmwlw0l564t4yp4c0er54s5r35667canhtxgj2pygvd6husss8uzw7ntf8f8qkespq8jx226xucczc2hyhe4k46xnu3k7yas4dn://api.explorer.provable.com/v1/mainnet/transaction/broadcast" -d '{"type":"execute","id":"at10fjwnhkzxsql782vjzrxluv6myvtegdswlq44havtad233yqj5ps8jdaq5","execution":{"transitions":[{"id":"au1zxd04q6cta6scnwxghhuhy32g59mwa3kujk0w3hexlx03yy0tgpsrssrxv","program":"credits.aleo","function":"transfer_public","inputs":[{"type":"public","id":"1682833075680742480191139139475017783635726675833615298134948094251641148789field","value":"aleo1uelpp2m2de9mnfsx644ezurlnexc57p5t6d8dgd8uf6r80hevsrs7y8zd6"},{"type":"public","id":"3432171524705518882450496953686808511340369028481592864921048418809815169257field","value":"1000u64"}],"outputs":[{"type":"future","id":"3226976518639693420182848413005449900147632463665036155639713901874002420761field","value":"{\n program_id: credits.aleo,\n function_name: transfer_public,\n arguments: [\n aleo1v4adjlsj3rjqqxdmup60lqxljgsl2nvckvfcewlgsq3cuu4ap5rq7t6xfh,\n aleo1uelpp2m2de9mnfsx644ezurlnexc57p5t6d8dgd8uf6r80hevsrs7y8zd6,\n 1000u64\n ]\n}"}],"tpk":"6469530160496930517842412017745145970481120034462859201865512864428583156412group","tcm":"7929033541928042429509503202381435887190127253359655415015389706531709884195field","scm":"2100450535345035298554210589860134710033657405847894357763256267454601660352field"}],"global_state_root":"sr1hm2yjpzegf0me0t3wstmg5w0hrng50avq86ydq5c22ghzqcntyyswhxjcl","proof":"proof1qyqsqqqqqqqqqqqpqqqqqqqqqqqvxuau0n7qjmhyhx86lu5083dy66jhuqu0agaxepneqx37f8pz9ngcjpsu449mpj85ad95w5vdkngpq9nu7z5e4t08tppu3h0x0u7hnj69hdks0qrp202tn6dpgeu8lcpa2hujdxa3jk3auqmqj8uhdz26vqvw63da6mnsdlc8p4hfnpvts0xh6dwge26dhr9aampz36gs6lmgvwmeyjgm23ju3k3gwh0s9yep4vqa0uxxrpmjn29dn558n6n4quwqav3fx8wsleygp9st3ngp92a7jewpnsghfkuz00svfxjgqve63tgp83trx6sddaag0syeferfxpdw9c4kc87kyehj2xepkq3rsfpejmfshkmmrlzt5h4g44cx8q49lrygqdwcj4ljvmc87hzy54d7drqtu8k8sfmum8y4fgle6erfsggdqw7u0txzctq8t9ywfn9pxe3lg3d8qqz5hemeyhmadsv7hr945frv65y5uqded62gxsyhflher98yuy4swal607c2f9dghpptk430swx87qwyy4xxx9h2g3yn99wcxuny2qajfy6jgsszznuaakmk256qfpsyx9ahedwh2vppx8svrzz7p39xngqt6hsk8pnedyqcfdta32rl8vsucrtaykgazp2g4n54gqrl64xktyccyxup9msj5waglaey4l9mjsupuqlku2dveptekcgwhet59q8nf837r6c9a796tpf70aj36uredyg3gxy7yt83pep5wym3enr67yhlavn9xs3lwycxj4rg78pjtj3cgyky8cgwwc0duv7nwvrx5xa2acqaq9e8fn333va0hf96khaw8fhlpnhaerweer22l0wkagkmg549l5jcy7pvaata0n6kffsh2qgvx3nqm27algwf2t0x6f2nnfrfaeeqaw0trcghnv2tp2le58qfwp8n8rctwkrtu8yazjw40j7u5jn6e8870g6r6r4jzxcs8uuwx9s40lamjvzqm4tv4c55gh4w3cynmasdyrvg6tmrezz63wvfatgxr5ud3mgqwzw6gd2gr24eghpv9htwsl3hgwdjespwcvc36m8k8fvxv3hz6vt5qpwtlzaykxv3qch8z74uysxxc2wpr9f0gn4azvmqgyzau5rzp5hspd507hz6sj2f4nu86x3s3zefpwx0d66c0n5vwsx4c84amafhytqjqvqqqqqqqqqqqt4r3z2l25z6pz5pq8h7a52kexqelh9dud3es4wrkzvdrkglsgpgnpmnx026nq5lswmu56zgszc9syq289l08hedc7daycexmwg5wu6xeek5hrlelsxnt7sf4xtfejp3nk8pfs5vcp77gdlqn5kk693qstuqqxgn7z83rj47ytfnjj78dcf0xxc4wclvc6ck6l8utyfgumszw9ess86x66ky9naelxkkh9rnetktv69f5ghfmgrypnrtafvzmdwhdlrsahwpj92vpr3wwljahm7yyljpqqqqnhv6le"},"fee":{"transition":{"id":"au1wt8a8z3ayrdwtucnjycq54qzx7qwlyzv50ern37t94563njy6yqqft29d2","program":"credits.aleo","function":"fee_public","inputs":[{"type":"public","id":"8124020456289718603871533833868384611700189823759467064079653770909594409002field","value":"80000u64"},{"type":"public","id":"1930768026035539769956271786208707751613007703869825636929992492639826254737field","value":"0u64"},{"type":"public","id":"7495437312089813518911442279312410728646421417338327192183672913169354945696field","value":"4576373785390793423366749782657053914482510397929291402495132511788528333872field"}],"outputs":[{"type":"future","id":"7030843522479431136207499476430692014830430082815981384449469151755990853054field","value":"{\n program_id: credits.aleo,\n function_name: fee_public,\n arguments: [\n aleo1v4adjlsj3rjqqxdmup60lqxljgsl2nvckvfcewlgsq3cuu4ap5rq7t6xfh,\n 80000u64\n ]\n}"}],"tpk":"763361653666138718979548143453621144398523091026325657042749971059396789868group","tcm":"1551779421000401245427485021048109257690180162871397961379508252041619593762field","scm":"6867897405462889860724223983258218823480664001924546405987741404998509431623field"},"global_state_root":"sr1hm2yjpzegf0me0t3wstmg5w0hrng50avq86ydq5c22ghzqcntyyswhxjcl","proof":"proof1qyqsqqqqqqqqqqqpqqqqqqqqqqqqlzmmwsgn804nagqgyfjnkrf4aqtugem0zagg4jcj3yvkzd2xfe4cmnetetd6lajgdvrd4fdfwpvqqywr3rjacy35w3f28a92q3p6jrapdl56qdtnw8v62d4gx0cux5u4rj04lfsw8swppqpy8gcencgygqfw23ztdpkcc7ntylcu79c3s6ewrh9cxlymg7hwp8he4ckh4rve0zn3wr8h0xdpe997jg2cxhh3skqxlwd62wemg3n6pgj2tdjhgyg3h4yh32cu7g60snq2gyjrvt5ec6re0s6cjyz0fcpls3h3hux9gquprve63cuac2v4pd7makpdspr5j04ranje6ya74jqfksl2jxtsa6dx4vxagez0vc8vnwaq39y86g4cr789e85w7fx5y3004sh4027tx4a625l9xyrhmxprgmrw7m3y7ng5cglzhynd7pamyg0aua03s403qqukku7szgvmawa9chqrv2mw2wzk5zyycxdqyts6fc5gjt3wh0c0qe2zz8ykhuqywcqn6akucqeaaq8nxazewlg8f4d77jt43mymule2enzp9qst3xf2qpdv0us2gtyhtzfe86200267zm5cny2g8m468wq6xy68hdnhc38trddzzfxcc76f0xa08mrc5ccnvysmxpes2safs54qhh9qc3plenuwrg3euuzskc5qj65l74q0yyhvplyjynp6usn08phw0u7rezfu95mdwu0uhc7ppuq4pltt5uz5j8v33twa4rg7st9gjwwutf0m4uf0e6h74k87vd8jsqz2z7nls7heh0jht8hyz5qs37ypnr94zqqydhkc9xnkf6g3mphupqmstf5cs0tdccgllgrv7gffga0ek0dx0qdympgnpnk3njmgj293ryklle0k2mhz2kq9y4pkahtsa0c7qkzzpw2wqa5h3v7pcechj5g06n646jjngqxnng6anzxs2dd8aqhe64g3zq00r5yc0h4g73hc0gzgd2j5e8k6um3p9dzhurvjvyf0n0rw5v98eg9v528nqc2d2yna5y8wcva2ru5jffsd5h978yscgd4lrxg9r6r82e3gca678ws0vqxxqgl4hzfn6s4kvjmytxxzt74yf6xexrts3taezl0nvwkrah75tqn3zsj88zjax8z42lw43hjdr93aag3zemm99ur0w5l8f3rpp3j043qrqvqqqqqqqqqqpc0kg2zmt86f6j6esywg88jklelkwu4gzmqr3y58g63rvdxvhfw8hr3us64hr8swuaw52dkzeznjsyqw6hl0a9efdnfszm90rngqy03qqd58pj2em3de47e3zsx68ayrm8sanv4s50q8atv4pw8kew4lur5qq96rx03px93kxy22g3y9wc7ygea5ha77c22huy2mtzl80ppgv42qvvt3q4t7nhp0g38tsa0v0jypyh4u8xl23ety7ceu66dd27yp2uc7z04hfn6hkqraegpvtrtfa7ldsqqqw3ttxc"}}'