区块链中的第一个交易请求在哪里?
Where does the first request for transaction go in a blockchain?
我的问题很简单。如果区块链上的用户想要发出交易请求,he/she 将向特定的 URL 发送请求。如果这个 URL 是动态的,那么如何选择一个特定的矿工来验证这个请求。
而且,如果它是一个静态的 URL,它是否会破坏网络去中心化的全部意义?因为如果你可以伪造一个特定的节点(接受交易请求并将其转发给所有矿工)
I know that won't this also arise the question in the latter scenario
that the same constraint goes there, as to how will the miners be
informed from the static URL. Well I feel if the address is known, the
miners will just keep sending requests for checking if a transaction
request has been made on that URL
感谢任何帮助
I am fairly new to blockchain but very eagerly interested to
understand this technology.
Sorry if my ideology is that of a rookie
here.
编辑:
我知道有相同的钱包服务,但我仍然提出同样的问题 - "if it is a static URL, won't it just dissolve the whole point of decentralizing the network?"
你需要有端点。 /transaction/broadcast 和/交易。
我们将把交易数据发送到我们网络中随机节点上的 /transaction/broadcast。在这个终点发生的第一件事,我们将从发送的数据创建一个新的交易。所以你应该已经有一个在你的区块链中创建的方法。
创建新交易后,我们必须将该交易广播到网络内的每个节点。此广播将在所有其他网络上的 /transaction 端点接收。
我们区块链中的每个节点都有一个其他节点的 url 数组。所以广播意味着将新交易发送到数组中的所有其他节点。剪下一小段代码会是这样的
const requestPromises = [];//sending transaction to each node returns a promise. so we store each promise inside the array.
blockchain.networkNodes.forEach(networkNodeUrl => {
const requestOptions = {
uri: networkNodeUrl + '/transaction',
method: 'POST',
body: newTransaction,
json: true
};
requestPromises.push(rp(requestOptions)); //I used request-promise library
});
一旦所有这些承诺都得到解决,这意味着我们的交易已成功创建。
Promise.all(requestPromises)
.then(data => {
res.json({ note: 'Transaction created and broadcast successfully.' });
});
我的问题很简单。如果区块链上的用户想要发出交易请求,he/she 将向特定的 URL 发送请求。如果这个 URL 是动态的,那么如何选择一个特定的矿工来验证这个请求。 而且,如果它是一个静态的 URL,它是否会破坏网络去中心化的全部意义?因为如果你可以伪造一个特定的节点(接受交易请求并将其转发给所有矿工)
I know that won't this also arise the question in the latter scenario that the same constraint goes there, as to how will the miners be informed from the static URL. Well I feel if the address is known, the miners will just keep sending requests for checking if a transaction request has been made on that URL
感谢任何帮助
I am fairly new to blockchain but very eagerly interested to understand this technology.
Sorry if my ideology is that of a rookie here.
编辑: 我知道有相同的钱包服务,但我仍然提出同样的问题 - "if it is a static URL, won't it just dissolve the whole point of decentralizing the network?"
你需要有端点。 /transaction/broadcast 和/交易。
我们将把交易数据发送到我们网络中随机节点上的 /transaction/broadcast。在这个终点发生的第一件事,我们将从发送的数据创建一个新的交易。所以你应该已经有一个在你的区块链中创建的方法。
创建新交易后,我们必须将该交易广播到网络内的每个节点。此广播将在所有其他网络上的 /transaction 端点接收。
我们区块链中的每个节点都有一个其他节点的 url 数组。所以广播意味着将新交易发送到数组中的所有其他节点。剪下一小段代码会是这样的
const requestPromises = [];//sending transaction to each node returns a promise. so we store each promise inside the array.
blockchain.networkNodes.forEach(networkNodeUrl => {
const requestOptions = {
uri: networkNodeUrl + '/transaction',
method: 'POST',
body: newTransaction,
json: true
};
requestPromises.push(rp(requestOptions)); //I used request-promise library
});
一旦所有这些承诺都得到解决,这意味着我们的交易已成功创建。
Promise.all(requestPromises)
.then(data => {
res.json({ note: 'Transaction created and broadcast successfully.' });
});