Simple Blockchain example in Java

5 stars based on 61 reviews

This is an annotation Jar I have created which adds Blockchain capabilites to any Java application including Android apps. I wrapped up the alpha of this today, it works.

Creating a blockchain ledger can provide self validating data. However, there is coding overhead and discovery involved. In order to make adding blockchain abilities easy, I created this annotation preprocessor for Java applications. What that means is, very little code combines with the preprocessor annotations provides a lot of software mechanics, without writing them.

In the "wired" age, we have to trust not only software, we have to trust data. As we decentralize our data centers into multiple fall overs redundanciesload balancing multiple front doors and such creatures as servlets multiple exploitable mini server code chunks the opportunities for bad actors increases. If one servlet, on one fall over is compromised then due to traffic volume the number of users can be affected may be quite high.

This is of course in addition to the media dissection, bad publicity, leaving room for competitors to take customers. With an annotated class of variables and a dash of business logic, one can create an entire block chain based self validating system. The business logic is clean, simple, easy to sustain and simple to add onto. The image shows our example application.

It is a simple implementation. There is a class "blockTest. The compiler uses these annotations to derive and write a new class based on "blockTest". It will write a class, on it's own at compile time, called "testBlockChainClass. We then create a class called "BlockChainTest. As it extends BlockChainTest, all of our runtime, base variables, setters and getters are now accessible.

The business logic that you see is all we need to create a fully functional blockchain system. It will add a ledger, create 5 records and send them to the ledger, and retrieve record 3. If we wanted to add a remote ledger or 2, it would be extremely simple see API reference on ledgers below for how this is done. The basic architecture is as follows. What can we use this for? Here a smart phone app verifies that the data within the local db and the remote ledgers are in alignment verifying that the remotes have not been tampered with, nor the local db.

There are times one does not want the blockchain mechanics to sit on the client side of a system for security and to avoid reverse engineering. The ledgers, validation and block chain mechanics can exist on the server side. The data may not be sent to the client if a compromised situation is determined.

Here is an implementation where an email server pumps incoming and outgoing emails to ledgers. The email server does not implement "fetch" so the data only goes one way to the ledgers. The ledgers are monitored by another application which verifies that the data has not been tampered with. Nothing has been modified, removed or artificially added.

This is handy for heavily regulated environments where email, email chains must be retained in order for compliance. Due to the mechanics, the system provides verifiable proof that the emails are not altered, deleted or altered. The ledgers may be distributed to remote data centers to provide redundancy as can the auditing system.

In this case, a data acquisition system for example pharma or diagnosticsretains all data and the paper trail for the raw data.

It also does so for the data analytics. This ensures raw data and results have not been altered. This may be good for a regulated environment where not just the data, but the peoples actions must be ensured. Multiple ledgers exist after acquisition to verify data integrity. The same exists for data analysis.

As the ledgers are additive, the historical sequence of events are stored to retain the events leading up to conclusions. All 4 remote ledgers are available for regulatory in order to validate integrity of the data and processes for compliance.

This may also be beneficial in defending an IP portfolio. The blockChain annotation system is not designed to exhibit the continuously degrading performance characteristic of cryptocurrency mining. In this tool set, that is avoided in order to provide usability. I suppose one can use this for crypto if they wanted to, however the goal of this is to be more general purpose.

The intent is to create a tool where the data is self validating and can leverage inference to audit the integrity of the run time software that creates it. So where will this annotation processor go? I have no idea at this time. If there is interest let me know if this thing sounds usefuland if I can make this worthwhile, then great! If not, then it was still a lot of fun to create.

By adding simple annotations, the entire heavy lifting of multiple ledgers that co-validate data, with data that self validates within it's link in a blockchain can be added with a few symbols and a handful of API calls. In your project properties, enable annotation processing, then add the jar in the Factory Path.

Now every time the project builds, the annotations will direct the compiler to execute the BlockChain. The BlockControl annotation declares a class as a "Block Chain" class. It is a class with variables that are accessed via setters and getters standard Java stuff. This will make more sense later on.

GetLedgerVariable denotes a getter which will provide a member variable value. By adding this annotation, that getter is now linked into the block chain. When you send your data out to the ledger s it will be pulled from this method.

SetLedgerVariable denotes a setter which will set a member variable value. By adding this annotation, that setter is now linked into the block chain and will be called when data returns from the ledger sprovided they are validated. The preprocessor will use your annotations and create this class file with everything predone. All of this can be accessed via a couple of API calls. This is a section of what the class looks like with the annotations. Just simply primitive variables, setters and getters.

I've tried to make the API calls as simple as possible. There are just a few in order to reduce code complexity. The createNewLedgerRecord indicates that you will be pushing out a new record to the ledgers. It performs all of the required initialization and preparation of a new ledger entry, including the "rolling" key. The generateLedgerEntry call commits your data to the ledgers. When called, it will call your getters to get those current values. It will perform all of the work in order to create a valid link and build the payload in JSON.

One call to this, and the current state of your data is sent to all ledgers. Included are the rolling key which will move forward, which sits internally, ready for the next commit. It will pull all records from all ledgers for the requested record.

It will then validate that they are all in alignment. If even one ledger is out of sync an error is flagged and a LedgerExpection is thrown. If the ledgers are in alignment, it will pull the data for the requested record, and extract all of the data as well as reconfirm that the block chain entry is accurate.

It will also validate that the data has not been tampered with. If any checks fail, the data is zero'd out and an error is flagged. If there is no error, the the data within you class is auto filled with the validated data.

The return value is true if the data passed validation, false if it failed. We can set some values within the system via a few API calls, or leave them as they are built by the preprocessor. It will default to what is declared in the BlockControl annotation. There is no limit to the size of the key. There is no limited character set. The keyLength determines the number of bytes within the block control validation.

The default value is bytes bits. You may set any value from 64 to bytes in length bits. A ledger tool is use to create and verify a payload of a set of values.

One can create a ledger tool, then use setLedgerTool to link it in so it is used. That way, custom validation can be created.

Alternatively one can rely on their "key" as set within the BlockControl annotation. A ledger can be a local database, flat file, SQL database, remote server, realm db or other thing one can think up. There is also no limit at this time to the number and types of ledgers you may connect. For example, you may use an SQL db on a mobile phone which also publishes to a remote server via secure comms. You may have a dozen remotes which will then all be part of the data validation.

Nxt sumo bot building skills

  • Vapor x r9 280x litecoin wallet

    Fedora 20 bitcoin exchange rate

  • Bitcoin kurz aktuln graf a vvoj ceny v btcusdeur

    Use cases for blockchain technology

Bitcoin bot maker apk

  • Current litecoin difficulty rated

    How to mine bitcoin with your maczdnet

  • Features and settings of the bitcoin trade robot trading software

    Emanuele monero gelateria naia

  • Hashes per second litecoin exchange rates

    Drum pump flammable liquids

Tatacara trading pada bitcoincoid metode otomatis mmakay autotrader nissan

32 comments Bitcoin stock exchange rate

Cloud 9 vs liquid csgo lounge trade

Openchain is an open source distributed ledger technology. It is suited for organizations wishing to issue and manage digital assets in a robust, secure and scalable way. Anyone can spin up a new Openchain instance within seconds. The administrator of an Openchain instance defines the rules of the ledger.

End-users can exchange value on the ledger according to those rules. Every transaction on the ledger is digitally signed, like with Bitcoin. Deploy your own private sidechain in seconds Blockchain technology, supercharged. How does it work? The consensus mechanism used by Openchain differs from other Bitcoin-based systems, it uses Partionned Consensus: Every Openchain instance only has one authority validating transactions.

Instead of one single central ledger, each organization controls their own Openchain instance. Instances can connect to each other. Different transactions will be validated by different authorities depending on the assets being exchanged. Every asset issuer has full control on the transactions relevant to that asset. More efficient Openchain is more efficient than systems that use Proof of Work: Openchain uses a client-server architecture which is more efficient and reliable than a peer-to-peer architecture.

There is no miner, transactions are directly validated by the asset administrator. Since there is no miner, transactions are instant and free.

Modular design Validators validate and store transactions. Observers receive a read-only copy of the ledger. They do their own validation of the ledger and store their own copy. Clients and wallets connect to validators to submit digitally signed transactions. Smart contracts are independent actors receiving and sending transactions according to arbitrary business logic.

Gateways create 2-way pegging between two Openchain instances. They can also peg the Openchain instance as a sidechain of the Bitcoin Blockchain. What are the use cases? Openchain is a generic register of ownership. It can be modelled to work with an immense number of use cases: Securities like stocks and bonds, commodities like gold and oil, currencies like the Dollar or even Bitcoin.

Titles of ownership like land titles, music or software licensing. Gift cards and loyalty points. Try the wallet Because an Openchain node exposes a simple HTTP endpoint, it's easy to build a wallet or client application, but we are providing a basic open source wallet for testing purposes. Try the basic Openchain wallet. Connect to the development server provided by Coinprism, or see below to spin up your own server. Create your own server instance It only takes a few seconds to spin up a new instance of Openchain server.

Create an instance, and use it to issue your own digital asset, and distribute it to people. Openchain is free and open source: Real-Time Transaction confirmation and account settlement doesn't take 3 days, or even 10 minutes.

Free Transactions There are no miners to subsidize, so transactions are completely free. For you, and for your users. Highly Scalable By skipping the inefficiencies of proof-of-work, Openchain can process thousands of transactions per second.

Immutable Openchain can publish a Proof of Integrity on the main Bitcoin Blockchain to ensure immutability and settlement finality. Hierarchical Openchain lets you define complex hierarchies of accounts to fit you business needs. Standalone No dependency on a third-party cryptocurrency, token or network. Privacy The level of privacy is completely customizable, from transparent and publicly auditable to private. Decentralized There is no central ledger. Instead, there are many specialized ledgers, run by different organizations, with different rules.

Smart Contracts Openchain is infinitely extensible through smart contract modules. Secure Unlike a traditional database, every transaction in Openchain is digitally signed. Keys are fully compatible with Bitcoin. Openchain is developed by Coinprism, the company behind the colored coins standard Open Assets. Contact us to learn more about our offering around Open Assets, Openchain and distributed ledgers.