This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <TaxIdentification> | |
| <PersonTypeCode>F</PersonTypeCode> | |
| <ResidenceTypeCode>R</ResidenceTypeCode> | |
| <TaxIdentificationNumber>00000000A</TaxIdentificationNumber> | |
| </TaxIdentification> | |
| <Individual> | |
| <Name>Antonio</Name> | |
| <FirstSurname>García</FirstSurname> | |
| <SecondSurname>Pérez</SecondSurname> | |
| <AddressInSpain> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <TaxIdentification> | |
| <PersonTypeCode>J</PersonTypeCode> | |
| <ResidenceTypeCode>R</ResidenceTypeCode> | |
| <TaxIdentificationNumber>A00000000</TaxIdentificationNumber> | |
| </TaxIdentification> | |
| <LegalEntity> | |
| <CorporateName>Perico de los Palotes S.A.</CorporateName> | |
| <AddressInSpain> | |
| <Address>C/ Falsa, 123</Address> | |
| <PostCode>23456</PostCode> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <FileHeader> | |
| <SchemaVersion>3.2.1</SchemaVersion> | |
| <Modality>I</Modality> | |
| <InvoiceIssuerType>EM</InvoiceIssuerType> | |
| <Batch> | |
| <BatchIdentifier>A000000001234FAC2018</BatchIdentifier> | |
| <InvoicesCount>1</InvoicesCount> | |
| <TotalInvoicesAmount> | |
| <TotalAmount>60.42</TotalAmount> | |
| </TotalInvoicesAmount> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <fe:Facturae xmlns:ds="http://www.w3.org/2000/09/xmldsig#" xmlns:fe="http://www.facturae.es/Facturae/2014/v3.2.1/Facturae"> | |
| <FileHeader>...</FileHeader> | |
| <Parties> | |
| <SellerParty>...</SellerParty> | |
| <BuyerParty>...</BuyerParty> | |
| </Parties> | |
| <Invoices> | |
| <Invoice>...</Invoice> | |
| </Invoices> | |
| <ds:Signature xmlns:xades="http://uri.etsi.org/01903/v1.3.2#">...</ds:Signature> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| private void send(ObjectOutputStream stream, Object message) { | |
| stream.writeObject(message); | |
| stream.flush(); | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| public void propagate(Object message) { | |
| new Thread(() -> { | |
| for (InetAddress ip : peers) { | |
| // Abrir socket hacia el nodo | |
| Socket s = new Socket(); | |
| s.connect( | |
| new InetSocketAddress(ip, Cutrecoin.PORT), | |
| Cutrecoin.TIMEOUT); | |
| ObjectOutputStream outputStream = | |
| new ObjectOutputStream(s.getOutputStream()); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| private void sync() { | |
| if (peers.isEmpty()) return; | |
| propagate("getBlock=latest"); | |
| propagate("getPendingTransactions"); | |
| isSynced = true; | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| void onNewMessage(ObjectOutputStream outputStream, Object message) { | |
| if (message instanceof Transaction) { | |
| // Guardamos la transacción para minería | |
| cutrecoin.addPendingTransaction((Transaction) message); | |
| } else if (message instanceof Block) { | |
| // Guardamos el bloque como candidato | |
| Block b = (Block) message; | |
| // Pedimos el bloque anterior al recibido | |
| if (cutrecoin.addCandidateBlock(b)) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| private void acceptClient(Socket s) { | |
| new Thread(() -> { | |
| // Abrir streams de salida y entrada | |
| // para objetos serializados de Java | |
| ObjectOutputStream outputStream = | |
| new ObjectOutputStream(s.getOutputStream()); | |
| ObjectInputStream inputStream = | |
| new ObjectInputStream(s.getInputStream()); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| private void connectToServer(InetAddress ip) { | |
| try { | |
| Socket s = new Socket(); | |
| s.connect( | |
| new InetSocketAddress(ip, Cutrecoin.PORT), | |
| Cutrecoin.TIMEOUT | |
| ); | |
| s.close(); | |
| // Añadir a la lista de nodos | |
| for (InetAddress ia : peers) { |