Owning bitcoin is all about controlling and securing your coins’ private keys. To send funds from your bitcoin wallet to another user, you have to sign the transaction using your private key. If you lose your private key, this means that you have literally lost your bitcoins. As such, it is pivotal to keep your private keys stored using the most secure means possible. Some people boost the security of private key storage via hiding them within plain text files via cold storage and hardware wallets.

A recently published research paper proposed a novel approach for hiding bitcoin’s private keys into steganographic fractals, which is an innovative technique that hasn’t been described before. This novel approach has been shown to be highly secure and resistant to attacks. Throughout this article, we will take a look at how bitcoin’s private keys can be hidden via steganographic fractals.

#### What are steganographic fractals?

A steganographic fractal is made of an infinite repeat of a simple geometric shape with different scales and rotations. A fractal has a very important feature called “Self Similarity”. It means that if you look at one part of the fractal fern, you will find that it has the same shape as the whole fractal fern. If you further look at the small fractal, you will find that it is composed of smaller fractals of the same shape. There are three categories of steganographic fractals: Natural Fractals, Geometric Fractals, and Algebraic Fractals. Geometric Fractals are created via repeating transformations on an initiator known as “attractor”. For instance, Sierpinski fractals are created by applying contractive transform (translating and resizing transforms) on a triangle. Sierpinski fractal is created via applying a collection of transforms known as “contractive transforms” on an attractor.

#### Proposed Fractal Trees:

A fractal tree is a tree created via recursively drawing a small attractor. The proposed fractal tree is comprised of a specific form of attractors. The proposed basic attractor is comprised of two branches, as illustrated in Figure (1), a right branch and a left branch. Each branch holds two arms, a right arm and a left arm which emerge from the branch’s body line. Each child attractor grows with a certain orientation dictated by the parent’s arm direction. Left and right branches incline by φ degrees on orientation of the source arm. Each branch inclines by an angle θ on the body line’s orientation.

**Figure (1): A sample fractal tree. A fractal’s tree attractor comprised of two branches, right and left. Each branch has a right and a left arm.** The fractal based steganography technique for embedding bitcoin’s private keys:

The embedding of bitcoin’s private key is accomplished via drawing a fractal tree with a predefined geometric shape. The angles and lengths of the fractal tree vary according to the values of the private key bit stream. An image processing procedure is used to extract the private keys from the fractal tree. The tree image is scanned and preprocessed. Hough transform is then used to extract the lines. The line coordinates are adapted to fit the entire tree inside a unit square. The origin is located at the lower line, which in this case is the root line.

**A- The private key embedding procedure** The embedding procedure begins with drawing the tree root line as shown in the flow diagram in figure (2). The tree root is not utilized through the embedding procedure. It is not considered a part of the fractal tree’s recursive structure. The second step is to plot the attractors. The left attractor is drawn recursively until a depth of L is reached. This is followed by recursively drawing the right attractor until all tree attractors are drawn. In each attractor, the left branch is drawn first, followed by the right branch. The preorder transversal is utilized throughout the process of the recursive drawing of the tree attractors.

**Figure (2): Steps of the proposed procedure for embedding bitcoin’s private keys**

1- Drawing the root lineAs shown in figure (1), a line is plotted to represent the root of the tree. The root line’s start point marks the origin of the tree, which is located at the middle lower part of the screen. The root line’s direction is (0, 1) which points upwards in the direction of the y-axis. This vector is marked in figure (1) by Vs. The coordinates’ root lines are (screen width / 2, 0) and (screen width /2, default line length La). The screen width represents the width of the drawing area. As we mentioned earlier, the drawing area is adapted to hold the entire tree within a unit square.

Thereafter, the origin will be translated to the root line’s lower vertex.2- Drawing a tree branchThe tree branch is comprised of three lines: the body line, the left arm, and the right arm. The body line makes an φ angle of 45^{o}, the left and right arms each make an θ angle of 45^{o} by default. The angles’ default values change in the upper levels of the tree in order to make the tree more natural and to reduce the probability of branch intersection. It is recommended to use different values for the angle θ of the left and right arms. The private key for the bitcoin wallet is transformed to binary values. The private key is referred to as the secure key, and the collection of its binary bits are referred to as the secure bits. As shown in figure (3), the algorithm embeds four secure bits within each tree branch. The angle φ changes according to the value of the first secure bit. The left arm’s angle changes according to the value of the second secure bit. The angle of the right arm changes according to the value of the third secure bit. The lengths of the left and right arms change according to the value of the fourth secure bit. The angles generally change to values in the range of δ degrees.

**Figure (3): Steps for drawing a tree branch**3- Recursively drawing the tree’s attractorsTo build a tree attractor, the following two parameters are required:– The source point: In the root attractor, it is represented by the origin Ps= (0, 0), while for higher level attractors, the source point is represented by the previous level attractor.– The source vector: In the root attractor, it is represented by Vs., while for higher level attractors, the source vector is identical to the previous level’s arm direction.In each attractor, the left branch is drawn first followed by the right branch. For each level, the angles (namely, θ and φ) are reduced by the angle’s reduction ratio β. Moreover, the entire attractor is resized by resize ratio γ. When moving from the tree’s lower levels to higher levels, the new angles and arm lengths are calculated by multiplying each value with the corresponding ratio. The secure bits alter the angles and arm lengths. When the security bits are entirely embedded, the remaining angles and tree branches will remain unchanged. Each attractor can secure 8 bits. Four bits for the left branch, and 4 bits for the right branch. As such, each attractor can securely store a single ASCII character (1 Byte). Each tree node can securely store one byte. A tree with 3 levels can store up to 21 bytes. The first level stores 1 byte, the second level stores 4 bytes, the third level stores 16 bytes, totaling 21 bytes in a fractal tree with three levels.**B- The private key extraction procedure:**The private key extraction procedure is accomplished via an image processing procedure called Hough transform as shown in Figure (4). Hough transform can identify many geometric patterns within an image

**Figure (4): Steps of extraction of the private keys from the fractal tree**The extraction procedure is done through the following steps:1- A snapshot of the fractal tree is taken using any digital camera.2- The image is processed via an edge detector. Sobel edge detector can be used to extract edges in the image. The image has to be then binarized. For each image pixel, either it is a background pixel or a line pixel.3- Hough transform is then applied onto the binarized image. Hough transform yields a list of spherical coordinate values for each line pixel. The maximum number of items within the list is the number of pixels within an imaginary diagonal line. A threshold is used to control the entries of the list entries. The threshold determines the minimum acceptable line length.4- The spherical coordinates are then converted to cartesian coordinates. The cartesian coordinates are then normalized, and the coordinate axes are converted to the lower middle of the image, i.e. the origin is located in the bottom center of the image.5- Starting with the origin, the algorithm traverses the tree in preorder traversal. Nearest line segments are found by Euclidean distance. The angles and lengths of the tree arms are calculated using simple trigonometry. Starting with θ=φ=45^{o}, the change in angle using the angle reduction ratio β is calculated. The bit stream can be extracted according to the difference in the angle values and the arm lengths. The final result will be the binary value of the private key, which will be finally converted to its hexadecimal characters.**Final thoughts:**Hiding bitcoin in fractal steganographic based trees is a novel approach for securing bitcoin’s private keys. Experiments show that the proposed system is extremely secure and highly resistant to attacks such as image and hardcopy attacks.

## Comment here