NOTE: These tips are general in nature and not specific to any one blockchains or crypto currencies. Many of the concepts and workings are shared between crypto currencies and are generally true.
Blockchains are in a very early stage, change happens rapidly. For one we know that the future will be a multichain world, in which many chains are used frequently for various uses or preference, and swapping between them is facilitated via bridges. Secondly since everything in the industry is in such an early stage, major changes are a given; Meaning that the blockchain you are working on could easily become less desired and you might to work with another chain instead or work with both.
Interoperability is only viable future. Just like the web, all technologies have to be able to communicate with each other to take advantage of the technological network effect and its possibilities.
A product that has limited scope is not very useful.
Ethereum uses the Ethereum Virtual Machine. This EVM has been forked many times, so by now the EVM is used in many more blockchains that are not Ethereum. This means if you write smart contracts for the EVM, these contracts will work just like that on another blockchain that uses the EVM. Similarly any code that interfaces with smart contracts on the EVM work the same on another. Ethereum has testnets like Rinkeby. Chains that use the EVM are just as similar as those.
Currently some chains that use the EVM besides Ethereum are for instance Binance Smart Chain and Polygon Matic.
This means if you write any code for Ethereum you can seamlessly use these chains as well, simply by changing your node URL and the chains ID. No other changes are necessary and everything will work just the same.
Of course the smart contracts you want to interact with may exist on one chain but not the other.
Other cases exist where a ot of code may work on both chains. For example forks of Bitcoin are numerous from Bitcoin Cash, over DogeCoin and even Monero. The more specialized a fork is, the less code may work, especially when chains went through hardforks to change the code. Some code will still work on all of them.
So in general it is good to be aware how interoperable your code is and make your final product as compatible as possible.
https://www.piecex.com/source-code/Bitcoin-Java-Module-643
Check out this and other codes at PieceX.com
This is generally true, but in specific when developing crypto currency related products, data and possibly functionality is needed which comes from outside your own product. Especially prices are impossible for you to know on your own, only trading markets have that data.
The most robust type of code relies on a local blockchain node which it communicates with to facilitate onchain commands and data. Without a local node run by the user, one has to rely on a third party to run a node for you and provide you with an API to their node.
https://www.piecex.com/source-code/C-Bitcoin-Connector-685
Third-party dependence naturally can reduce the longevity of your product, since the product you are depending on might go offline/stop working permanently. As such, your product should be structured in such a way that data providers are easy to switch out. If the code is too specific to one external provider it may be too much work to change it once the providers becomes unreliable.
In general, automated checks allowing you to see if a provider has downtime are highly recommended. That way you would know quickly automatically, when your product stops working, that the provider is at fault and not anything within your code.
Many centralized crypto currency exchanges provide numerous endpoint APIs to use in order to trade there, including many functions such as market buy stop losses etc. For these you will need a fully registered and approved account and enabled those APIs.
Similarly some decentralized exchanges offer APIs to facilitate trading/swapping functionality. In the best case you can simply use their smart contract yourself directly if this is on a smart contract platform. That way you are not reliant on any front or backend the exchange may provide.
Also test this kind of code in a test environment since any mistake could result in quick loss of all funds due to unexpected behavior.
https://www.piecex.com/source-code/Bitcoin-Wallet-Template-Fully-functional-621
When acquiring source code related to crypto currencies, numerous critical security strategies should be kept in mind. These security aspects can cause users of the code to lose all of their crypto currencies due to leaking of private keys, secret syphoning off of transactions or flawed key generation.
Meaning you have to make sure that key generation algorithms are not tampered with, since these could be modified, either on purpose or on accident in such a way that they key can be predicted.
If your code includes functionality related to transactions, it is vital that the code is not modified in a way in which hidden code may take a part of the transaction or the entire transaction being sent, and sends it to another address. Blockchain transactions are of course immutable and irreversible. A malicious part of code might try to take your coins upon sending, that way you might not notice, especially if it’s just a small part.
The most common malicious attack however would be a very straight forward way of just sniffing your private keys from the get-go, either via fake features which are fishing or real features that create a copy of your keys and such.
Any code that touches keys needs to be audited in detail.
If your code does not touch private keys directly, which a lot of cryptocurrency related products may not, in those cases there is less of a danger.
Always download dependencies from trusted and verified sources when working with crypto, although this is recommended in general.
Do not trust, verify.
Similarly, when not relying on the users own local node, you will have to connect to a URL which connects to a node, being run by a third party. This node can potentially be deceptive and malicious. Keep that in mind.
https://www.piecex.com/source-code/BitcoinCash-Address-Generator-1206
Check out this and other codes at PieceX.com
ADDRESS REUSAGE
For UTXO systems like Bitcoin, reusing of addresses is highly discouraged. The idea is to generate a new address for every transaction via the wallet.
Systems like Ethereum are account based where this is more lax. But remember, in any system you forfeit some pseudo anonymity by recycling addresses.
UP TO DATE CODE
As the blockchain industry is very young and constantly changing, making sure the code you use is absolutely up to date with the latest hard forks and inner workings is of upmost importance. When using old code, many unwanted side effect could occur since algorithm may have changed by now or more secure ways of performing actions have been adopted by now.
https://www.piecex.com/source-code/Crypto-Casino-Crash-Mines-Dice-and-much-more-2785
MULTIPLE DATA SOURCE
It is recommended to use multiple data sources for all critical pieces of data your product relies upon. So that if one data source goes down or shows an odd result, you make sure to always get the data you expect.