Task: Read a Quote, Write a Quote (using JavaScript)

If you run ./goal node status -d data from your node directory, that should be enough to generate the algod.token file (almost all goal commands against algod ensure the file exists).

1 Like


1 Like

i really have to work my brain on this lol…

1 Like


“by”: “Richard Dawkins”,
“text”: “the solution often turns out more beautiful than the puzzle”

1 Like

guys… this is not possible for noob like me… pls make tutorial for newbie :dizzy_face:

1 Like

My hint is to start with the write a quote, since the reading is a bit harder. Also you might look at the example given on the JavaScript-sdk docs

@liz helpp. I dont understand node js. I tried starting it with “node index.js”. Then I try accessing webpage with all sort of ports and its still empty.


Node is used to execute JS outside of the browser. What specific example are you trying to run?

Hi, I managed to start it. I have generate an account and send tokens (using dispenser). Next, when I tried to submit transaction to NJY27OQ2ZXK6OWBN44LE4K43TA2AV3DPILPYTHAJAMKIVZDWTEJKZJKO4A account, I got these error :

algosdk.min.js:1 Uncaught TypeError: c is not a constructor
at Object.decode (algosdk.min.js:1)
at new Transaction (algosdk.min.js:1)
at Object.signTransaction (algosdk.min.js:1)
at HTMLButtonElement.st.onclick (index.js:140)

Where did I do wrong? Thx

Can you post your code?

I am using algosdk.min.js which I get from pluggin (algosdk)
st.onclick = function() {debugger;

        ta.innerHTML = "";

        txn = {
            "from": account,
            "to": to.value.toString(),
            "fee": 10,
            "amount": parseInt(algos.value),
            "firstRound": parseInt(fround.value),
            "lastRound": parseInt(lround.value),
            "note": new Uint8Array(0)

        (error here) **var signedTxn = algosdk.signTransaction(txn, signKey);**

As a Writer:


Decoding @liz’s very first, unposted tx-FF6XMT6QVVYNCZXSHBGTUVDHKPOUCK57S7GAXVKPMB4CS26WZBIA which corresponds to the same quote

“Imagination is more important than knowledge.” - Albert Einstein

1 Like

A few places where imported packages could be named consistently as these subtle differences algosdk vs. algodsdk can go unnoticed and cause trouble if code is mixed and matched.

const algosdk = require('algosdk');
const algodsdk = require('algosdk');

I got these error when trying to get latest block :

TypeError: Cannot read property ‘transactions’ of undefined
at Algod.block (/root/node_modules/algosdk/src/client/algod.js:162:48)
at process._tickCallback (internal/process/next_tick.js:68:7)

Its fix after I replace it with algod.js retrieved from git

@liz, I am trying to send a transaction ( done creating wallet, account, backup) but I got these error instead :

{ Error: cannot POST /v1/transactions (400)
at Response.toError (/root/node_modules/algosdk/node_modules/superagent/lib/node/response.js:94:15)
at ResponseBase._setStatusProperties (/root/node_modules/algosdk/node_modules/superagent/lib/response-base.js:123:16)
at new Response (/root/node_modules/algosdk/node_modules/superagent/lib/node/response.js:41:8)
at Request._emitResponse (/root/node_modules/algosdk/node_modules/superagent/lib/node/index.js:850:20)
at IncomingMessage.parser (/root/node_modules/algosdk/node_modules/superagent/lib/node/index.js:1036:38)
at IncomingMessage.emit (events.js:194:15)
at endReadableNT (_stream_readable.js:1125:12)
at process._tickCallback (internal/process/next_tick.js:63:19)
status: 400,
‘TransactionPool.Remember: failed to call Committed(): txTail: tried to check for dup in missing round 53400’,
method: ‘POST’,
path: ‘/v1/transactions’ }

ok fixed. i found that i put the round too small as my previous round

1 Like

As a writer :

1 Like

Thank you @Mrynza , indeed on line 162 of the algosdk/src/client/algod.js it needs the addition of the body (which exists one line below), i.e. res.body.txns.transactions !== undefined instead of res.txns.transactions !== undefined

@Mrynza, not sure why, but I’m unable to locate this transaction ID.

What am I missing?

1 Like

Is it related to the round? It seems that they are only reading 100 previous blocks. I cant locate mine / yours too