Code Monkey home page Code Monkey logo

Comments (8)

keppel avatar keppel commented on June 8, 2024

hey @Elvenisboy, great questions!

If I query this information in another peer, I can’t get it, right?

correct, you'll only wanna GET /txs to interact with a lotion server running locally.

how to let one lotion peer connect another one?

you can specify the locations of other tendermint nodes you want to connect to like this:

let app = lotion({
  p2pPort: 46656,
  peers: [
    'localhost:46657',
    '12.22.11.33:46657',
    '<ip>:<p2p-port>',
    '<other-ip>:<other-p2p-port>'
  ]
  // ... plus your other app options here ...
})

also consider whether a light client might do what you need in this section of the readme!

thanks @Elvenisboy, holla if anything else is confusing.

from lotion.

poria-cat avatar poria-cat commented on June 8, 2024

Aha, thanks for you answer @keppel😁. This is a sad story if I can get txs only in local. In a Blockchain app , we can’t avoid querying txs in database. Such as query somebody’s account balance or develop a Blockchain explorer. So if I wanna to get a complete data, what should I do? 😀😀

from lotion.

keppel avatar keppel commented on June 8, 2024

you can run a full node locally, connect it to a peer, then querying /txs should give you the same output on either node!

Such as query somebody’s account balance

you should probably just keep account balances in your state object, and query /state to figure out someone's balance! it should be pretty rare that you need to directly query /txs, it's usually just the current state of your blockchain that you'll care about for most apps.

from lotion.

poria-cat avatar poria-cat commented on June 8, 2024

@keppel OK~ Thank you for your help😋

from lotion.

poria-cat avatar poria-cat commented on June 8, 2024

Hey~keppel @keppel I found a interesting thing. when i run couter app, and add a tx in it like this:

 curl http://localhost:3000/txs -d '{"name":"b"}'

then, use this url in firefox:

http://localhost:3000/tendermint/abci_query?data="name"

it will give me a message in bash:

FATAL ERROR STACK:  RangeError: not enough data for decode
    at Object.decode (/home/elven/Work/test-lotion/node_modules/varstruct/lib/varbuffer.js:28:41)
    at Object.decode (/home/elven/Work/test-lotion/node_modules/varstruct/lib/varstring.js:19:31)
    at /home/elven/Work/test-lotion/node_modules/varstruct/lib/object.js:36:36
    at Object.exports.size (/home/elven/Work/test-lotion/node_modules/varstruct/lib/util.js:6:49)
    at Object.decode (/home/elven/Work/test-lotion/node_modules/varstruct/lib/object.js:35:27)
    at exports.decode.queryBuffer (/home/elven/Work/test-lotion/node_modules/lotion/lib/query-encoding.js:9:29)
    at AbciApp.abciApp.query (/home/elven/Work/test-lotion/node_modules/lotion/lib/abci-app.js:139:17)
    at Connection.msgCb (/home/elven/Work/test-lotion/node_modules/lotion/lib/abci/server.js:70:34)
    at Connection.appendData (/home/elven/Work/test-lotion/node_modules/lotion/lib/abci/connection.js:38:10)
    at Socket.<anonymous> (/home/elven/Work/test-lotion/node_modules/lotion/lib/abci/connection.js:15:10)
FATAL ERROR:  RangeError: not enough data for decode
    at Object.decode (/home/elven/Work/test-lotion/node_modules/varstruct/lib/varbuffer.js:28:41)
    at Object.decode (/home/elven/Work/test-lotion/node_modules/varstruct/lib/varstring.js:19:31)
    at /home/elven/Work/test-lotion/node_modules/varstruct/lib/object.js:36:36
    at Object.exports.size (/home/elven/Work/test-lotion/node_modules/varstruct/lib/util.js:6:49)
    at Object.decode (/home/elven/Work/test-lotion/node_modules/varstruct/lib/object.js:35:27)
    at exports.decode.queryBuffer (/home/elven/Work/test-lotion/node_modules/lotion/lib/query-encoding.js:9:29)
    at AbciApp.abciApp.query (/home/elven/Work/test-lotion/node_modules/lotion/lib/abci-app.js:139:17)
    at Connection.msgCb (/home/elven/Work/test-lotion/node_modules/lotion/lib/abci/server.js:70:34)
    at Connection.appendData (/home/elven/Work/test-lotion/node_modules/lotion/lib/abci/connection.js:38:10)
    at Socket.<anonymous> (/home/elven/Work/test-lotion/node_modules/lotion/lib/abci/connection.js:15:10)

emmmm, and I found that I can't add a new tx in blockchain, so sad 😢

This may be a bug for tendermint 😕

from lotion.

keppel avatar keppel commented on June 8, 2024

not a bug in tendermint, just related to the way I handle abci queries in the abci server that lotion manages!

for now, I'd pretend /tendermint doesn't exist -- you should be able to build an app on just /txs and /state.

if you wanna describe what you'd like to do, I'd be happy to explain how exactly you might go about building it w/ lotion!

thanks for your questions btw -- I'll try to clarify the things you ask about in the readme. :)

from lotion.

poria-cat avatar poria-cat commented on June 8, 2024

Thanks again~ I wanna develop a ACG community with tendermint and lotion~ Few days ago, I found lotion, and it is friendly than cosmos-sdk(I think) 😄 Can I join lotion slack group? @keppel

from lotion.

keppel avatar keppel commented on June 8, 2024

awesome! you absolutely may jump in the slack. :)

from lotion.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.