In this episode, Alexandre walks us through how a wallet talks to the EOS blockchain.Transcription:
Okay, hi everyone!
So we've received a few questions about how the wallet interacts with "nodeos."
"Nodeos" is the "daemon," like the the main blockchain software. It's been called like that, they left it. Whatever. So "nodeos" is the blockchain where you have all the database, and in-memory contracts, and all that. The wallet is also another server --
(phone rings) woah... Hi Michelle? It's recording… Okay, love you, bye…
Okay back to the wallet. The wallet is another "daemon." It listens on another port and what happens is this. If you want to create a transaction, a transaction is made up of one or many actions, and actions are the operation. Like if you want to transfer funds, the action is "transfer." And if you want to use another contract that votes on presidential candidates, well there's going to be a "vote" action on the contract perhaps, like, "presidential candidate," or something like that. Okay.
And see, these are two separate actions, and they can be put into one transaction. Actions and transaction. Then you take the transaction, and you ask the blockchain, so "nodeos," we're calling there, first of all, for a few of the latest blocks. Because you want to mark in the transaction what's the few latest blocks you've seen. And that adds to the security of the network. You're vouching for an irreversible block there.
And also you'll want to ask the blockchain which keys do I need to sign with for that transaction to be valid? So you're asking for the required keys. And then, it'll give you: "oh you need to sign with that key." And now you turn around, and you go query the wallet and you send the transaction, plus the key it needs to sign with. And then the wallet is just going take the transaction, it does not communicate with the outside world. The only thing it does, is it takes
your transaction, signs it, and gives you the signature back with the transaction there. So you can take the signature now and go back to the blockchain and publish it. You just push the transaction that is signed and all the blockchains are going to propagate over there. Everyone's
going to execute the actions, update the internal state of the memory in there, and verify the signature. If the signature is good, then a transaction is accepted. If the signature is not good,
it's going to be refused by the first node so that it never propagates through the network.
So that's how "nodeos" relates to the wallet. The wallet manages your secret keys, and secret key material. You want that to be very secure. And the blockchain "nodeos" is very public. It can communicate, and you can read, and push transactions. The only 'write' operation on the blockchain is "push transaction." So that's how the database is updated through transactions.