Skip to content

The goal is to build a simple app to store a binary Merkle tree and an API to retrieve certain information about the tree. The app should be deployed to AWS using infrastructure-as-code (IaC)

License

Notifications You must be signed in to change notification settings

linnienaryshkin/merkle-tree

Repository files navigation

Merkle tree

This is an exercise done for an interview process. Read more about it in TASK.md

💡 Merkle Trees are a very useful data storage tool which makes data verification and integrity checking efficient. They are widely used in the blockchain space. A binary Merkle tree is a specific case of a Merkle tree in which nodes have to 2 children.

Merkel Tree example

Deployment

  1. Authorization - follow the guide, you need an active AWS access portal session for the AWS CDK.
  2. Bootstrapping - deploying stacks with the AWS CDK requires dedicated Amazon S3 buckets and other containers to be available to AWS CloudFormation during deployment.

After, you should be available to deploy.

  • cdk synth emits the synthesized CloudFormation template
  • cdk deploy deploy this stack to your default AWS account/region
  • cdk diff compare deployed stack with the current state

Usage

Current CDK expose two lambdas.

  1. writeMerkleTree - paramsless function, launch once to store static Merkle Tree in S3 bucket

  2. readMerkleTree - accepts Merkle Tree Node index, the return value of that node, depth and offset (read TASK.md to understand more)

    Additionally, readMerkleTree is connected to AWS API Gateway, and by curl https://{BASE_URL}/merkle-tree/{nodeIndex} you'll get the same output

Be Aware

In the core of the project, you'll find cdk.context.json - highly recommended to fill it in case of production usage :)

Read more here: https://docs.aws.amazon.com/cdk/v2/guide/context.html

About

The goal is to build a simple app to store a binary Merkle tree and an API to retrieve certain information about the tree. The app should be deployed to AWS using infrastructure-as-code (IaC)

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published