Smart contract optimization