!etUivBFgFPNCqFxYir:matrix.org

Cosmos-SDK

727 Members
45 Servers

Load older messages


Timestamp Message
21 Jan 2020
04:29:58@vincesim:matrix.orgvincesimHello. I'm working on an app that uses the Cosmos SDK to implement database functionality using distributed consensus. I want the user to be able to query key/values, as well as get a list of keys, query for the existence of keys and other common DB functionality. I need the client to be able to validate that the responses received have been validated by >= 2/3 of the validators in the network. Could you please tell me the best way of doing this? Thanks.
05:40:59@yenkhoon:matrix.orgyenkhoon
In reply to @vincesim:matrix.org
Hello. I'm working on an app that uses the Cosmos SDK to implement database functionality using distributed consensus. I want the user to be able to query key/values, as well as get a list of keys, query for the existence of keys and other common DB functionality. I need the client to be able to validate that the responses received have been validated by >= 2/3 of the validators in the network. Could you please tell me the best way of doing this? Thanks.
by default all the tx is validated by validator already. You will need to customize your querrier end points.
05:43:10@vincesim:matrix.orgvincesim yenkhoon: 1) How do I "demonstrate" this validation to users? 2) How would I do this with queries rather than transactions?
08:08:07@vincesim:matrix.orgvincesimBy demonstrate, I mean, is there something in the response, or another way, that I can get the signatures associated with the validation so that there is proof the transaction is valid in a way that can be displayed to users. Thanks.
09:06:53@imxuneal:matrix.org@imxuneal:matrix.org left the room.
09:46:27@yenkhoon:matrix.orgyenkhoon
In reply to @vincesim:matrix.org
By demonstrate, I mean, is there something in the response, or another way, that I can get the signatures associated with the validation so that there is proof the transaction is valid in a way that can be displayed to users. Thanks.
build a scanner to scan your block with the transaction hash
16:55:23@stef356412:matrix.orgstef356412 joined the room.
16:57:54@stef356412:matrix.orgstef356412Hey guys. This is Stefan Co-founder of The Capital (Altcoin Magazine) - a social finance news aggregator where over 1000 different companies, enthusiasts, experts, etc. have contributed their educational content since we started. 
 We have over 90,000 unique visitors majorly from Europe, the USA, and Asia. Our readers consist of crypto traders (retail & institutional), blockchain enthusiasts, business owners, tech entrepreneurs, etc. We would like to offer you guys a free interview, if that's something you could be interested in? If so, please contact business@thecapital.io Have a look at our interviews, we maintain a very high-quality standard Example of founder interview: https://medium.com/altcoin-magazine/interview-with-ceo-ed-moncada-from-blockfolio-on-altcoin-magazine-da5de271cd8c Example of project rundown interview: https://medium.com/altcoin-magazine/interview-with-enjin-coin-on-altcoin-magazine-969703f0fbff
21:59:45@rnistuk:matrix.orgrnistukHello. We have modified the namespace example by creating a x/module with our own transactions. Currently our transactions do not use gas(stake) or distribute stake to validators. I understand that we must use the ante package via the ante handler with a deduct fee decorator, but we are having difficulty finding an example on how to use them. I'd really like to see how gas gets distributed to the reward pool during a successful tx. It is our understanding that validators can then get what they have earned from the reward pool. But, we're unsure of how to implement that accounting. Thank you.
22 Jan 2020
17:52:17@randomshinichi:matrix.orgrandomshinichi joined the room.
17:56:23@randomshinichi:matrix.orgrandomshinichi

Hello, I'm Andrew Chiw, working together with Ape Unit, and I'm going through the Cosmos nameservice tutorial. The tutorial seems more updated now, but I've got a weird go linter error. in x/nameservice/internal/types/errors.go I have

package types

import (
	sdk "github.com/cosmos/cosmos-sdk/types"
)

// Local code type
type CodeType = sdk.CodeType

const (
	// Default nameservice codespace
	DefaultCodespace sdk.CodespaceType = ModuleName

	// CodeInvalid      CodeType = 101
	CodeNameDoesNotExist sdk.CodeType = 101
)

and the linter says undeclared name: ModuleName. But key.go is verified in the same package:

package types

const (
	// ModuleName is the name of the module
	ModuleName = "nameservice"

	// StoreKey to be used when creating the KVStore
	StoreKey = ModuleName

	// RouterKey to be used for routing msgs
	RouterKey = ModuleName

	QuerierRoute = ModuleName
)

Any idea why this might be happening?

17:56:53@randomshinichi:matrix.orgrandomshinichi *

Hello, I'm Andrew Chiw, working together with Ape Unit, and I'm going through the Cosmos nameservice tutorial. The tutorial seems more updated now, but I've got a weird go linter error. in x/nameservice/internal/types/errors.go I have

package types

import (
	sdk "github.com/cosmos/cosmos-sdk/types"
)

// Local code type
type CodeType = sdk.CodeType

const (
	// Default nameservice codespace
	DefaultCodespace sdk.CodespaceType = ModuleName

	// CodeInvalid      CodeType = 101
	CodeNameDoesNotExist sdk.CodeType = 101
)

and the linter says undeclared name: ModuleName. But key.go is verified in the same package:

package types

const (
	// ModuleName is the name of the module
	ModuleName = "nameservice"

	// StoreKey to be used when creating the KVStore
	StoreKey = ModuleName

	// RouterKey to be used for routing msgs
	RouterKey = ModuleName

	QuerierRoute = ModuleName
)

Any idea why this might be happening?

18:47:23@yenkhoon:matrix.orgyenkhoonyou can just ignore the golint
23 Jan 2020
00:45:34@rnistuk:matrix.orgrnistukHello, We've written a module using the sdk to handle our transactions and queries. As we step through the daemon code handling a transaction initiated by the client for a validator, we can see that gas is being calculated and consumed, but when we review the accounts after the tx has been written to the blockchain our validator balances remain the same. We see our validator account being accessed and used in the method create by NewAnteHandler. Where is the gas being used? Is gas being used? Thank you.
11:22:53@randomshinichi:matrix.orgrandomshinichi
In reply to @yenkhoon:matrix.org
you can just ignore the golint
I was concerned because if golint complains, then the compiler will refuse to compile...
I tried https://tutorials.cosmos.network/nameservice/tutorial/06-keeper.html about a month ago, it wasn't working/up to date back then. Can I rely on it to be up to date now?
21:09:08@njmurarka:matrix.orgnjmurarka
In reply to @nnkken:matrix.org

Your understanding is right. (Now I feel great pleasure from successfully educating someone 🙂)

For the "more complicated way", basically you need application for initiating a new round of voting on a value, and actually voting for a value.
You will need to design the voting mechanism (how to start a voting round, when does a voting round ends, can voters change their vote for the same round, etc), permission management (who can vote, how to add / remove voters), incentive / disincentive (reward to people voted for the consensus value, or punish voters who didn't vote frequently enough), etc.
You may also need a convenient external program for voters, which manages the private keys, queries the external data source and votes automatically, so they don't need to run the voting process manually.

I think these are much more complicated (but also much more robust) than having nodes to accessing the internet on their own.
I don't know if there is a common module for this in the community, you may refer to the built-in governance module, and also Terra's oracle module.

Seems like I will have to do a deep dive into Terra's "oracle" module. Given I have yet to read it, did they in fact implement this "more complicated way" that you are talking about?

I wanted to take some time to think about the whole "problem-statement" before replying. Indeed, there are some real challenges here -- the entropy of involving Internet connections beyond the connections between the nodes themselves is much too dangerous, if the application logic involving these Internet connections can result in inconsistencies even in "honest" conditions. That's clearly very bad.

Perhaps what I am about to say is along the lines of your "more complicated way". I have not fleshed it out in detail yet. Just very high level.

The reason I even got into this topic was to somehow leverage the fact that we have n validators, each with private keys of their own, a mutating validator set that they all know of, and the fact that we could potentially get each such validator to do "work" in a "trustless" way. That's precisely what they do as blockchain PoS validators -- validate TX's. Why not validate other things? The problem is they cannot just validate anything... it is risky, if the validation "rules" are kept the same as a blockchain TX.

What if we look at each validator like a voter, like in "Who wants to be a Millionaire", when you "Ask the audience"? Let's say the question is 100% deterministic, comes with an Internet Endpoint to get the answer from, and every question gets asked every nth block, and answers can be submitted within an m block window. So, let's say there are 10 validators. Every 20 blocks (height = 20, 40, etc...) they get a 5 block window (from 20-24, 40-44, etc...) to ask this deterministic question, get an answers, and submit that answer, as a standard TX, to write to the blockchain some value. Perhaps the question is something extremely deterministic like "what was the USD/EUR price, according to Bloomberg, at 00:00:00.000 on DDMMYYYY UTC"? The endpoint is "bloomberg.com/usd-eur/date-time-info". It is also 100% deterministic which blockheight and corresponding window, the "votes" from the "audience" can be found in, given this question. So let's say that this question is answered by votes in the 20-24 block "window". Out of the 10 nodes, 5 of them come back with the same exact answer, and register their votes. Unfortunately, 1 of them comes back with the wrong answer, and 4 of them don't even vote.

Now, the other side. Let's say a "client" connects to this chain at height 28, and wants to know the answer to the aforementioned question? How is it answered? A querier (and/or this could be a TX handler, for more "safety") looks into the blockchain within the blockheight window determined by the question (20-24), and tabulates all the audience votes, much like "Who wants to be a Millionaire". We find 5 of the same votes, 1 different vote, and 4 abstainees. Ok. Based on the validator set in that window (for simplicity lets take the MAX # of validators in that block window and say it is 10 for now), we have 50% of the audience voting one way, and 10% voting another. That information is returned back to the client. They can take that and use it as they please, much like a "Who wants to be a Millionaire" contestant. Some clients might be ok with that, and take that answer the 5 gave back. Some might want more.

Thoughts? Gotchas? Am I just re-stating what you had in mind?

I figure the first part of this would just be "event code" that fires independently, much like a "dApp" that is baked into the blockchain, but where each node is at this point submitting a TX as if the node itself is a client submitting a vote as a unique TX. And the clients, later, when asking the question, get handled by a pretty standard querier and/or TX handler.

Apologies again for the length. Brevity is not my strong suit.

24 Jan 2020
03:24:34@nnkken:matrix.orgnnkken
In reply to @njmurarka:matrix.org

Seems like I will have to do a deep dive into Terra's "oracle" module. Given I have yet to read it, did they in fact implement this "more complicated way" that you are talking about?

I wanted to take some time to think about the whole "problem-statement" before replying. Indeed, there are some real challenges here -- the entropy of involving Internet connections beyond the connections between the nodes themselves is much too dangerous, if the application logic involving these Internet connections can result in inconsistencies even in "honest" conditions. That's clearly very bad.

Perhaps what I am about to say is along the lines of your "more complicated way". I have not fleshed it out in detail yet. Just very high level.

The reason I even got into this topic was to somehow leverage the fact that we have n validators, each with private keys of their own, a mutating validator set that they all know of, and the fact that we could potentially get each such validator to do "work" in a "trustless" way. That's precisely what they do as blockchain PoS validators -- validate TX's. Why not validate other things? The problem is they cannot just validate anything... it is risky, if the validation "rules" are kept the same as a blockchain TX.

What if we look at each validator like a voter, like in "Who wants to be a Millionaire", when you "Ask the audience"? Let's say the question is 100% deterministic, comes with an Internet Endpoint to get the answer from, and every question gets asked every nth block, and answers can be submitted within an m block window. So, let's say there are 10 validators. Every 20 blocks (height = 20, 40, etc...) they get a 5 block window (from 20-24, 40-44, etc...) to ask this deterministic question, get an answers, and submit that answer, as a standard TX, to write to the blockchain some value. Perhaps the question is something extremely deterministic like "what was the USD/EUR price, according to Bloomberg, at 00:00:00.000 on DDMMYYYY UTC"? The endpoint is "bloomberg.com/usd-eur/date-time-info". It is also 100% deterministic which blockheight and corresponding window, the "votes" from the "audience" can be found in, given this question. So let's say that this question is answered by votes in the 20-24 block "window". Out of the 10 nodes, 5 of them come back with the same exact answer, and register their votes. Unfortunately, 1 of them comes back with the wrong answer, and 4 of them don't even vote.

Now, the other side. Let's say a "client" connects to this chain at height 28, and wants to know the answer to the aforementioned question? How is it answered? A querier (and/or this could be a TX handler, for more "safety") looks into the blockchain within the blockheight window determined by the question (20-24), and tabulates all the audience votes, much like "Who wants to be a Millionaire". We find 5 of the same votes, 1 different vote, and 4 abstainees. Ok. Based on the validator set in that window (for simplicity lets take the MAX # of validators in that block window and say it is 10 for now), we have 50% of the audience voting one way, and 10% voting another. That information is returned back to the client. They can take that and use it as they please, much like a "Who wants to be a Millionaire" contestant. Some clients might be ok with that, and take that answer the 5 gave back. Some might want more.

Thoughts? Gotchas? Am I just re-stating what you had in mind?

I figure the first part of this would just be "event code" that fires independently, much like a "dApp" that is baked into the blockchain, but where each node is at this point submitting a TX as if the node itself is a client submitting a vote as a unique TX. And the clients, later, when asking the question, get handled by a pretty standard querier and/or TX handler.

Apologies again for the length. Brevity is not my strong suit.

I think the flow is correct, but a few supplementary points:

  1. Base on how the voting rules are designed, the voters need not be validators. You can design a special oracle role dedicated for providing the chain these extra information.
  2. The main point of having these external data source on chain is to enable the chain's application logic to run according to these external data. If it's only for clients to query, then given that the external data source is reliable (I won't use the term deterministic since I prefer to use this term only for pure functions in computations, which is not applicable for external data), the clients can simply query the external data source themselves. But if the chain's logic is, say, to transfer money from the loser to the winner in a bet inside the chain's logic, then the chain must somehow know the result of the bet. And in this case, the chain must have its own criteria for judging the voting results from the oracles, e.g. >2/3 of oracles agree.
10:41:28@indicar:matrix.orgindicar joined the room.
10:44:51@indicar:matrix.orgindicarHello everyone. I've been battling understanding the withdrawal of rewards. Maybe I ask a quick question here? I think it would be trivial for an experienced community to answer. Or if there is a better place to ask questions, please direct me.
10:50:37@indicar:matrix.orgindicarI'll just ask, because it is quick.
10:50:41@indicar:matrix.orgindicar

I've used the nameservice skeleton (https://github.com/cosmos/sdk-tutorials/tree/master/nameservice) and added a mint module. I've created a single validator, and have observed that rewards are being distributed:

nscli query distribution validator-outstanding-rewards cosmosvaloper1nxkeq749cwvrkv9nvkzhhpu6cw6dlejx305808

Should I be able to withdraw these rewards with the following command?:

nscli tx distribution withdraw-rewards cosmosvaloper1nxkeq749cwvrkv9nvkzhhpu6cw6dlejx305808 --from node1 --yes --chain-id "test-chain-VNIcyI"
10:51:00@indicar:matrix.orgindicar *

I've used the nameservice skeleton (https://github.com/cosmos/sdk-tutorials/tree/master/nameservice) and added a mint module. I've created a single validator, and have observed that rewards are being distributed:

nscli query distribution validator-outstanding-rewards cosmosvaloper1nxkeq749cwvrkv9nvkzhhpu6cw6dlejx305808

Should I be able to withdraw these rewards with the following command?:

nscli tx distribution withdraw-rewards cosmosvaloper1nxkeq749cwvrkv9nvkzhhpu6cw6dlejx305808 --from node1 --yes --chain-id "test-chain-VNIcyI"
10:54:03@howl0s:matrix.orghowl0s joined the room.
11:22:43@indicar:matrix.orgindicarRedacted or Malformed Event
11:48:50@indicar:matrix.orgindicar

The query of the rewards for delegation yields an empty list []:

nscli query distribution rewards cosmos1nxkeq749cwvrkv9nvkzhhpu6cw6dlejx5mqjr5 cosmosvaloper1nxkeq749cwvrkv9nvkzhhpu6cw6dlejx305808

This code calls the same function calculateDelegationRewards that is called when a withdrawal is issued.

18:35:22@vincesim:matrix.orgvincesimHello. I've noticed that if I configure the lite client daemon with "trust-node" to false, a query to read a value from the store using a local LCD and local node can take anything from 1/2 a second to 3 or 4 seconds to return a result from a REST request. Is this normal? Is there anything I can do to speed this up while still validating/proofing the result? Am I doing something wrong? Any idea why it takes so long? Thanks in advance!
18:36:55@vincesim:matrix.orgvincesim * Hello. I've noticed that if I configure the lite client daemon with "trust-node" to false, a query to read a value from the store using a local LCD and local node can take anything from 1/2 a second to 3 or 4 seconds to return a result from a REST request. Is this normal? Is there anything I can do to speed this up while still validating/proofing the result? Am I doing something wrong? Any idea why it takes so long? Thanks in advance!
19:56:35@cbarraford:matrix.orgcbarrafordRedacted or Malformed Event
22:45:39@cbarraford:matrix.orgcbarraford *
25 Jan 2020
06:12:06@indicar:matrix.orgindicarBTW: I figured out my issue. Commission of the validator was set at 100%, which meant that there were no standard rewards to withdraw.

There are no newer messages yet.


Back to Room List